From 68aa336f5fa3a57346db82de53fb1a652f62cf67 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Wed, 5 Jan 2011 00:14:25 +0900 Subject: [PATCH] Removed TABs and trailing whitespace from GtkComboBox and GtkTreeMenu --- gtk/gtkcombobox.c | 1633 ++++++++++++++++++++++----------------------- gtk/gtkcombobox.h | 18 +- gtk/gtktreemenu.c | 1028 ++++++++++++++-------------- gtk/gtktreemenu.h | 38 +- 4 files changed, 1357 insertions(+), 1360 deletions(-) diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 977c08287e..648b534f32 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -247,8 +247,8 @@ static guint combo_box_signals[LAST_SIGNAL] = {0,}; static void gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface); static void gtk_combo_box_cell_editable_init (GtkCellEditableIface *iface); static GObject *gtk_combo_box_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties); + guint n_construct_properties, + GObjectConstructParam *construct_properties); static void gtk_combo_box_dispose (GObject *object); static void gtk_combo_box_finalize (GObject *object); static void gtk_combo_box_destroy (GtkWidget *widget); @@ -263,7 +263,7 @@ static void gtk_combo_box_get_property (GObject *object, GParamSpec *spec); static void gtk_combo_box_state_changed (GtkWidget *widget, - GtkStateType previous); + GtkStateType previous); static void gtk_combo_box_grab_focus (GtkWidget *widget); static void gtk_combo_box_style_updated (GtkWidget *widget); static void gtk_combo_box_button_toggled (GtkWidget *widget, @@ -312,7 +312,7 @@ static gboolean gtk_combo_box_draw (GtkWidget *widget, static gboolean gtk_combo_box_scroll_event (GtkWidget *widget, GdkEventScroll *event); static void gtk_combo_box_set_active_internal (GtkComboBox *combo_box, - GtkTreePath *path); + GtkTreePath *path); static void gtk_combo_box_check_appearance (GtkComboBox *combo_box); static void gtk_combo_box_real_move_active (GtkComboBox *combo_box, @@ -322,32 +322,32 @@ static gboolean gtk_combo_box_real_popdown (GtkComboBox *combo_box) /* listening to the model */ static void gtk_combo_box_model_row_inserted (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data); + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data); static void gtk_combo_box_model_row_deleted (GtkTreeModel *model, - GtkTreePath *path, - gpointer user_data); + GtkTreePath *path, + gpointer user_data); static void gtk_combo_box_model_rows_reordered (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gint *new_order, - gpointer user_data); + GtkTreePath *path, + GtkTreeIter *iter, + gint *new_order, + gpointer user_data); static void gtk_combo_box_model_row_changed (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data); + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data); static void gtk_combo_box_model_row_expanded (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data); + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data); /* list */ -static void gtk_combo_box_list_position (GtkComboBox *combo_box, - gint *x, - gint *y, - gint *width, - gint *height); +static void gtk_combo_box_list_position (GtkComboBox *combo_box, + gint *x, + gint *y, + gint *width, + gint *height); static void gtk_combo_box_list_setup (GtkComboBox *combo_box); static void gtk_combo_box_list_destroy (GtkComboBox *combo_box); @@ -361,18 +361,18 @@ static gboolean gtk_combo_box_list_enter_notify (GtkWidget *widget, GdkEventCrossing *event, gpointer data); static void gtk_combo_box_list_auto_scroll (GtkComboBox *combo, - gint x, - gint y); + gint x, + gint y); static gboolean gtk_combo_box_list_scroll_timeout (GtkComboBox *combo); static gboolean gtk_combo_box_list_button_pressed (GtkWidget *widget, GdkEventButton *event, gpointer data); static gboolean gtk_combo_box_list_select_func (GtkTreeSelection *selection, - GtkTreeModel *model, - GtkTreePath *path, - gboolean path_currently_selected, - gpointer data); + GtkTreeModel *model, + GtkTreePath *path, + gboolean path_currently_selected, + gpointer data); static void gtk_combo_box_list_row_changed (GtkTreeModel *model, GtkTreePath *path, @@ -391,32 +391,32 @@ static gboolean gtk_combo_box_menu_button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data); static void gtk_combo_box_menu_activate (GtkWidget *menu, - const gchar *path, - GtkComboBox *combo_box); + const gchar *path, + GtkComboBox *combo_box); static void gtk_combo_box_update_sensitivity (GtkComboBox *combo_box); static gboolean gtk_combo_box_menu_key_press (GtkWidget *widget, - GdkEventKey *event, - gpointer data); + GdkEventKey *event, + gpointer data); static void gtk_combo_box_menu_popup (GtkComboBox *combo_box, - guint button, - guint32 activate_time); + guint button, + guint32 activate_time); /* cell layout */ GtkCellArea *gtk_combo_box_cell_layout_get_area (GtkCellLayout *cell_layout); static gboolean gtk_combo_box_mnemonic_activate (GtkWidget *widget, - gboolean group_cycling); + gboolean group_cycling); static void gtk_combo_box_child_show (GtkWidget *widget, - GtkComboBox *combo_box); + GtkComboBox *combo_box); static void gtk_combo_box_child_hide (GtkWidget *widget, - GtkComboBox *combo_box); + GtkComboBox *combo_box); /* GtkComboBox:has-entry callbacks */ static void gtk_combo_box_entry_contents_changed (GtkEntry *entry, - gpointer user_data); + gpointer user_data); static void gtk_combo_box_entry_active_changed (GtkComboBox *combo_box, - gpointer user_data); + gpointer user_data); /* GtkBuildable method implementation */ @@ -424,48 +424,48 @@ static GtkBuildableIface *parent_buildable_iface; static void gtk_combo_box_buildable_init (GtkBuildableIface *iface); static gboolean gtk_combo_box_buildable_custom_tag_start (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - GMarkupParser *parser, - gpointer *data); + GtkBuilder *builder, + GObject *child, + const gchar *tagname, + GMarkupParser *parser, + gpointer *data); static void gtk_combo_box_buildable_custom_tag_end (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - gpointer *data); + GtkBuilder *builder, + GObject *child, + const gchar *tagname, + gpointer *data); static GObject *gtk_combo_box_buildable_get_internal_child (GtkBuildable *buildable, - GtkBuilder *builder, - const gchar *childname); + GtkBuilder *builder, + const gchar *childname); /* GtkCellEditable method implementations */ static void gtk_combo_box_start_editing (GtkCellEditable *cell_editable, - GdkEvent *event); - -static void gtk_combo_box_get_preferred_width (GtkWidget *widget, - gint *minimum_size, - gint *natural_size); -static void gtk_combo_box_get_preferred_height (GtkWidget *widget, - gint *minimum_size, - gint *natural_size); -static void gtk_combo_box_get_preferred_width_for_height (GtkWidget *widget, - gint avail_size, - gint *minimum_size, - gint *natural_size); -static void gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget, - gint avail_size, - gint *minimum_size, - gint *natural_size); + GdkEvent *event); + +static void gtk_combo_box_get_preferred_width (GtkWidget *widget, + gint *minimum_size, + gint *natural_size); +static void gtk_combo_box_get_preferred_height (GtkWidget *widget, + gint *minimum_size, + gint *natural_size); +static void gtk_combo_box_get_preferred_width_for_height (GtkWidget *widget, + gint avail_size, + gint *minimum_size, + gint *natural_size); +static void gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget, + gint avail_size, + gint *minimum_size, + gint *natural_size); G_DEFINE_TYPE_WITH_CODE (GtkComboBox, gtk_combo_box, GTK_TYPE_BIN, - G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, - gtk_combo_box_cell_layout_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE, - gtk_combo_box_cell_editable_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, - gtk_combo_box_buildable_init)) + G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, + gtk_combo_box_cell_layout_init) + G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE, + gtk_combo_box_cell_editable_init) + G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, + gtk_combo_box_buildable_init)) /* common */ @@ -530,7 +530,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) * @widget: the object that received the signal * @scroll_type: a #GtkScrollType * - * The ::move-active signal is a + * The ::move-active signal is a * keybinding signal * which gets emitted to move the active selection. * @@ -550,7 +550,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) * GtkComboBox::popup: * @widget: the object that received the signal * - * The ::popup signal is a + * The ::popup signal is a * keybinding signal * which gets emitted to popup the combo box list. * @@ -570,8 +570,8 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) * GtkComboBox::popdown: * @button: the object which received the signal * - * The ::popdown signal is a - * keybinding signal + * The ::popdown signal is a + * keybinding signal * which gets emitted to popdown the combo box list. * * The default bindings for this signal are Alt+Up and Escape. @@ -591,54 +591,54 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) binding_set = gtk_binding_set_by_class (widget_class); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, GDK_MOD1_MASK, - "popup", 0); + "popup", 0); gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, GDK_MOD1_MASK, - "popup", 0); + "popup", 0); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, GDK_MOD1_MASK, - "popdown", 0); + "popdown", 0); gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, GDK_MOD1_MASK, - "popdown", 0); + "popdown", 0); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, - "popdown", 0); + "popdown", 0); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP); gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Up, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP); gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Up, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Home, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START); gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Home, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN); gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Down, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN); gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Down, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN); gtk_binding_entry_add_signal (binding_set, GDK_KEY_End, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END); gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_End, 0, - "move-active", 1, - GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END); + "move-active", 1, + GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END); /* properties */ g_object_class_override_property (object_class, @@ -649,7 +649,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) * GtkComboBox:model: * * The model from which the combo box takes the values shown - * in the list. + * in the list. * * Since: 2.4 */ @@ -684,11 +684,11 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) /** * GtkComboBox:row-span-column: * - * If this is set to a non-negative value, it must be the index of a column - * of type %G_TYPE_INT in the model. + * If this is set to a non-negative value, it must be the index of a column + * of type %G_TYPE_INT in the model. * - * The values of that column are used to determine how many rows a value in - * the list will span. Therefore, the values in the model column pointed to + * The values of that column are used to determine how many rows a value in + * the list will span. Therefore, the values in the model column pointed to * by this property must be greater than zero and not larger than wrap-width. * * Since: 2.4 @@ -707,11 +707,11 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) /** * GtkComboBox:column-span-column: * - * If this is set to a non-negative value, it must be the index of a column - * of type %G_TYPE_INT in the model. + * If this is set to a non-negative value, it must be the index of a column + * of type %G_TYPE_INT in the model. * - * The values of that column are used to determine how many columns a value - * in the list will span. + * The values of that column are used to determine how many columns a value + * in the list will span. * * Since: 2.4 */ @@ -731,7 +731,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) * * The item which is currently active. If the model is a non-flat treemodel, * and the active item is not an immediate child of the root of the tree, - * this property has the value + * this property has the value * gtk_tree_path_get_indices (path)[0], * where path is the #GtkTreePath of the active item. * @@ -750,8 +750,8 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) /** * GtkComboBox:add-tearoffs: * - * The add-tearoffs property controls whether generated menus - * have tearoff menu items. + * The add-tearoffs property controls whether generated menus + * have tearoff menu items. * * Note that this only affects menu style combo boxes. * @@ -759,12 +759,12 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) */ g_object_class_install_property (object_class, PROP_ADD_TEAROFFS, - g_param_spec_boolean ("add-tearoffs", - P_("Add tearoffs to menus"), - P_("Whether dropdowns should have a tearoff menu item"), - FALSE, - GTK_PARAM_READWRITE)); - + g_param_spec_boolean ("add-tearoffs", + P_("Add tearoffs to menus"), + P_("Whether dropdowns should have a tearoff menu item"), + FALSE, + GTK_PARAM_READWRITE)); + /** * GtkComboBox:has-frame: * @@ -775,24 +775,24 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) */ g_object_class_install_property (object_class, PROP_HAS_FRAME, - g_param_spec_boolean ("has-frame", - P_("Has Frame"), - P_("Whether the combo box draws a frame around the child"), - TRUE, - GTK_PARAM_READWRITE)); - + g_param_spec_boolean ("has-frame", + P_("Has Frame"), + P_("Whether the combo box draws a frame around the child"), + TRUE, + GTK_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_FOCUS_ON_CLICK, g_param_spec_boolean ("focus-on-click", - P_("Focus on click"), - P_("Whether the combo box grabs focus when it is clicked with the mouse"), - TRUE, - GTK_PARAM_READWRITE)); + P_("Focus on click"), + P_("Whether the combo box grabs focus when it is clicked with the mouse"), + TRUE, + GTK_PARAM_READWRITE)); /** * GtkComboBox:tearoff-title: * - * A title that may be displayed by the window manager + * A title that may be displayed by the window manager * when the popup is torn-off. * * Since: 2.10 @@ -809,7 +809,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) /** * GtkComboBox:popup-shown: * - * Whether the combo boxes dropdown is popped up. + * Whether the combo boxes dropdown is popped up. * Note that this property is mainly useful, because * it allows you to connect to notify::popup-shown. * @@ -851,10 +851,10 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) g_object_class_install_property (object_class, PROP_HAS_ENTRY, g_param_spec_boolean ("has-entry", - P_("Has Entry"), - P_("Whether combo box has an entry"), - FALSE, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + P_("Has Entry"), + P_("Whether combo box has an entry"), + FALSE, + GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** * GtkComboBox:entry-text-column: @@ -867,12 +867,12 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) g_object_class_install_property (object_class, PROP_ENTRY_TEXT_COLUMN, g_param_spec_int ("entry-text-column", - P_("Entry Text Column"), - P_("The column in the combo box's model to associate " - "with strings from the entry if the combo was " - "created with #GtkComboBox:has-entry = %TRUE"), - -1, G_MAXINT, -1, - GTK_PARAM_READWRITE)); + P_("Entry Text Column"), + P_("The column in the combo box's model to associate " + "with strings from the entry if the combo was " + "created with #GtkComboBox:has-entry = %TRUE"), + -1, G_MAXINT, -1, + GTK_PARAM_READWRITE)); /** * GtkComboBox:id-column: @@ -917,12 +917,12 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) g_object_class_install_property (object_class, PROP_POPUP_FIXED_WIDTH, g_param_spec_boolean ("popup-fixed-width", - P_("Popup Fixed Width"), - P_("Whether the popup's width should be a " - "fixed width matching the allocated width " - "of the combo box"), - TRUE, - GTK_PARAM_READWRITE)); + P_("Popup Fixed Width"), + P_("Whether the popup's width should be a " + "fixed width matching the allocated width " + "of the combo box"), + TRUE, + GTK_PARAM_READWRITE)); /** * GtkComboBox:cell-area: @@ -934,10 +934,10 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) g_object_class_install_property (object_class, PROP_CELL_AREA, g_param_spec_object ("cell-area", - P_("Cell Area"), - P_("The GtkCellArea used to layout cells"), - GTK_TYPE_CELL_AREA, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + P_("Cell Area"), + P_("The GtkCellArea used to layout cells"), + GTK_TYPE_CELL_AREA, + GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); gtk_widget_class_install_style_property (widget_class, g_param_spec_boolean ("appears-as-list", @@ -957,13 +957,13 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) * Since: 2.12 */ gtk_widget_class_install_style_property (widget_class, - g_param_spec_int ("arrow-size", - P_("Arrow Size"), - P_("The minimum size of the arrow in the combo box"), - 0, - G_MAXINT, - 15, - GTK_PARAM_READABLE)); + g_param_spec_int ("arrow-size", + P_("Arrow Size"), + P_("The minimum size of the arrow in the combo box"), + 0, + G_MAXINT, + 15, + GTK_PARAM_READABLE)); /** * GtkComboBox:shadow-type: @@ -1111,7 +1111,7 @@ gtk_combo_box_set_property (GObject *object, case PROP_POPUP_FIXED_WIDTH: gtk_combo_box_set_popup_fixed_width (combo_box, - g_value_get_boolean (value)); + g_value_get_boolean (value)); break; case PROP_EDITING_CANCELED: @@ -1139,7 +1139,7 @@ gtk_combo_box_set_property (GObject *object, area = g_value_get_object (value); if (area) - combo_box->priv->area = g_object_ref_sink (area); + combo_box->priv->area = g_object_ref_sink (area); break; default: @@ -1212,12 +1212,12 @@ gtk_combo_box_get_property (GObject *object, break; case PROP_HAS_ENTRY: - g_value_set_boolean (value, priv->has_entry); - break; + g_value_set_boolean (value, priv->has_entry); + break; case PROP_ENTRY_TEXT_COLUMN: - g_value_set_int (value, priv->text_column); - break; + g_value_set_int (value, priv->text_column); + break; case PROP_ID_COLUMN: g_value_set_int (value, priv->id_column); @@ -1228,8 +1228,8 @@ gtk_combo_box_get_property (GObject *object, break; case PROP_CELL_AREA: - g_value_set_object (value, priv->area); - break; + g_value_set_object (value, priv->area); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1239,7 +1239,7 @@ gtk_combo_box_get_property (GObject *object, static void gtk_combo_box_state_changed (GtkWidget *widget, - GtkStateType previous) + GtkStateType previous) { GtkComboBox *combo_box = GTK_COMBO_BOX (widget); GtkComboBoxPrivate *priv = combo_box->priv; @@ -1299,33 +1299,33 @@ gtk_combo_box_check_appearance (GtkComboBox *combo_box) appears_as_list = FALSE; else gtk_widget_style_get (GTK_WIDGET (combo_box), - "appears-as-list", &appears_as_list, - NULL); + "appears-as-list", &appears_as_list, + NULL); if (appears_as_list) { /* Destroy all the menu mode widgets, if they exist. */ if (GTK_IS_MENU (priv->popup_widget)) - gtk_combo_box_menu_destroy (combo_box); + gtk_combo_box_menu_destroy (combo_box); /* Create the list mode widgets, if they don't already exist. */ if (!GTK_IS_TREE_VIEW (priv->tree_view)) - gtk_combo_box_list_setup (combo_box); + gtk_combo_box_list_setup (combo_box); } else { /* Destroy all the list mode widgets, if they exist. */ if (GTK_IS_TREE_VIEW (priv->tree_view)) - gtk_combo_box_list_destroy (combo_box); + gtk_combo_box_list_destroy (combo_box); /* Create the menu mode widgets, if they don't already exist. */ if (!GTK_IS_MENU (priv->popup_widget)) - gtk_combo_box_menu_setup (combo_box, TRUE); + gtk_combo_box_menu_setup (combo_box, TRUE); } gtk_widget_style_get (GTK_WIDGET (combo_box), - "shadow-type", &priv->shadow_type, - NULL); + "shadow-type", &priv->shadow_type, + NULL); } static void @@ -1385,7 +1385,7 @@ gtk_combo_box_add (GtkContainer *container, if (priv->has_entry && !GTK_IS_ENTRY (widget)) { g_warning ("Attempting to add a widget with type %s to a GtkComboBox that needs an entry " - "(need an instance of GtkEntry or of a subclass)", + "(need an instance of GtkEntry or of a subclass)", G_OBJECT_TYPE_NAME (widget)); return; } @@ -1411,7 +1411,7 @@ gtk_combo_box_add (GtkContainer *container, { gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (priv->separator)), priv->separator); - priv->separator = NULL; + priv->separator = NULL; gtk_widget_queue_resize (GTK_WIDGET (container)); } @@ -1430,8 +1430,8 @@ gtk_combo_box_add (GtkContainer *container, _gtk_entry_set_is_cell_renderer (GTK_ENTRY (widget), TRUE); g_signal_connect (widget, "changed", - G_CALLBACK (gtk_combo_box_entry_contents_changed), - combo_box); + G_CALLBACK (gtk_combo_box_entry_contents_changed), + combo_box); gtk_entry_set_has_frame (GTK_ENTRY (widget), priv->has_frame); } @@ -1439,7 +1439,7 @@ gtk_combo_box_add (GtkContainer *container, static void gtk_combo_box_remove (GtkContainer *container, - GtkWidget *widget) + GtkWidget *widget) { GtkComboBox *combo_box = GTK_COMBO_BOX (container); GtkComboBoxPrivate *priv = combo_box->priv; @@ -1452,12 +1452,12 @@ gtk_combo_box_remove (GtkContainer *container, child_widget = gtk_bin_get_child (GTK_BIN (container)); if (widget && widget == child_widget) - { - g_signal_handlers_disconnect_by_func (widget, - gtk_combo_box_entry_contents_changed, - container); + { + g_signal_handlers_disconnect_by_func (widget, + gtk_combo_box_entry_contents_changed, + container); _gtk_entry_set_is_cell_renderer (GTK_ENTRY (widget), FALSE); - } + } } if (widget == priv->cell_view) @@ -1490,15 +1490,15 @@ gtk_combo_box_remove (GtkContainer *container, priv->cell_view = gtk_cell_view_new (); gtk_widget_set_parent (priv->cell_view, GTK_WIDGET (container)); _gtk_bin_set_child (GTK_BIN (container), priv->cell_view); - + gtk_widget_show (priv->cell_view); gtk_cell_view_set_model (GTK_CELL_VIEW (priv->cell_view), - priv->model); + priv->model); } if (appears_as_list) - gtk_combo_box_list_setup (combo_box); + gtk_combo_box_list_setup (combo_box); else gtk_combo_box_menu_setup (combo_box, TRUE); @@ -1541,7 +1541,7 @@ gtk_combo_box_menu_hide (GtkWidget *menu, static void gtk_combo_box_detacher (GtkWidget *widget, - GtkMenu *menu) + GtkMenu *menu) { GtkComboBox *combo_box = GTK_COMBO_BOX (widget); GtkComboBoxPrivate *priv = combo_box->priv; @@ -1549,11 +1549,11 @@ gtk_combo_box_detacher (GtkWidget *widget, g_return_if_fail (priv->popup_widget == (GtkWidget *) menu); g_signal_handlers_disconnect_by_func (menu->priv->toplevel, - gtk_combo_box_menu_show, - combo_box); + gtk_combo_box_menu_show, + combo_box); g_signal_handlers_disconnect_by_func (menu->priv->toplevel, - gtk_combo_box_menu_hide, - combo_box); + gtk_combo_box_menu_hide, + combo_box); priv->popup_widget = NULL; } @@ -1587,7 +1587,7 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box, priv->popup_widget = popup; - /* + /* * Note that we connect to show/hide on the toplevel, not the * menu itself, since the menu is not shown/hidden when it is * popped up while torn-off. @@ -1598,53 +1598,53 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box, G_CALLBACK (gtk_combo_box_menu_hide), combo_box); gtk_menu_attach_to_widget (GTK_MENU (popup), - GTK_WIDGET (combo_box), - gtk_combo_box_detacher); + GTK_WIDGET (combo_box), + gtk_combo_box_detacher); } else { if (!priv->popup_window) { - GtkWidget *toplevel; - + GtkWidget *toplevel; + priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP); gtk_widget_set_name (priv->popup_window, "gtk-combobox-popup-window"); - gtk_window_set_type_hint (GTK_WINDOW (priv->popup_window), - GDK_WINDOW_TYPE_HINT_COMBO); - - g_signal_connect (GTK_WINDOW (priv->popup_window),"show", - G_CALLBACK (gtk_combo_box_child_show), - combo_box); - g_signal_connect (GTK_WINDOW (priv->popup_window),"hide", - G_CALLBACK (gtk_combo_box_child_hide), - combo_box); - - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (combo_box)); - if (GTK_IS_WINDOW (toplevel)) - { - gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)), - GTK_WINDOW (priv->popup_window)); - gtk_window_set_transient_for (GTK_WINDOW (priv->popup_window), - GTK_WINDOW (toplevel)); - } - - gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE); + gtk_window_set_type_hint (GTK_WINDOW (priv->popup_window), + GDK_WINDOW_TYPE_HINT_COMBO); + + g_signal_connect (GTK_WINDOW (priv->popup_window),"show", + G_CALLBACK (gtk_combo_box_child_show), + combo_box); + g_signal_connect (GTK_WINDOW (priv->popup_window),"hide", + G_CALLBACK (gtk_combo_box_child_hide), + combo_box); + + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (combo_box)); + if (GTK_IS_WINDOW (toplevel)) + { + gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)), + GTK_WINDOW (priv->popup_window)); + gtk_window_set_transient_for (GTK_WINDOW (priv->popup_window), + GTK_WINDOW (toplevel)); + } + + gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE); gtk_window_set_screen (GTK_WINDOW (priv->popup_window), gtk_widget_get_screen (GTK_WIDGET (combo_box))); - priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL); - - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), - GTK_POLICY_NEVER, - GTK_POLICY_NEVER); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->scrolled_window), - GTK_SHADOW_IN); + priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL); + + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), + GTK_POLICY_NEVER, + GTK_POLICY_NEVER); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->scrolled_window), + GTK_SHADOW_IN); gtk_widget_show (priv->scrolled_window); - - gtk_container_add (GTK_CONTAINER (priv->popup_window), - priv->scrolled_window); + + gtk_container_add (GTK_CONTAINER (priv->popup_window), + priv->scrolled_window); } gtk_container_add (GTK_CONTAINER (priv->scrolled_window), @@ -1676,10 +1676,10 @@ get_widget_border (GtkWidget *widget, static void gtk_combo_box_menu_position_below (GtkMenu *menu, - gint *x, - gint *y, - gint *push_in, - gpointer user_data) + gint *x, + gint *y, + gint *push_in, + gpointer user_data) { GtkComboBox *combo_box = GTK_COMBO_BOX (user_data); GtkAllocation child_allocation; @@ -1721,15 +1721,15 @@ gtk_combo_box_menu_position_below (GtkMenu *menu, *y = sy; screen = gtk_widget_get_screen (GTK_WIDGET (combo_box)); - monitor_num = gdk_screen_get_monitor_at_window (screen, + monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET (combo_box))); gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); - + if (*x < monitor.x) *x = monitor.x; else if (*x + req.width > monitor.x + monitor.width) *x = monitor.x + monitor.width - req.width; - + if (monitor.y + monitor.height - *y - child_allocation.height >= req.height) *y += child_allocation.height; else if (*y - monitor.y >= req.height) @@ -1744,10 +1744,10 @@ gtk_combo_box_menu_position_below (GtkMenu *menu, static void gtk_combo_box_menu_position_over (GtkMenu *menu, - gint *x, - gint *y, - gboolean *push_in, - gpointer user_data) + gint *x, + gint *y, + gboolean *push_in, + gpointer user_data) { GtkComboBox *combo_box; GtkWidget *active; @@ -1788,14 +1788,14 @@ gtk_combo_box_menu_position_over (GtkMenu *menu, child = children->data; if (active == child) - break; + break; if (gtk_widget_get_visible (child)) - { - gtk_widget_get_allocation (child, &child_allocation); + { + gtk_widget_get_allocation (child, &child_allocation); - menu_ypos -= child_allocation.height; - } + menu_ypos -= child_allocation.height; + } children = children->next; } @@ -1805,7 +1805,7 @@ gtk_combo_box_menu_position_over (GtkMenu *menu, gdk_window_get_root_coords (gtk_widget_get_window (widget), menu_xpos, menu_ypos, - &menu_xpos, &menu_ypos); + &menu_xpos, &menu_ypos); /* Clamp the position on screen */ screen_width = gdk_screen_get_width (gtk_widget_get_screen (widget)); @@ -1823,24 +1823,24 @@ gtk_combo_box_menu_position_over (GtkMenu *menu, static void gtk_combo_box_menu_position (GtkMenu *menu, - gint *x, - gint *y, - gint *push_in, - gpointer user_data) + gint *x, + gint *y, + gint *push_in, + gpointer user_data) { GtkComboBox *combo_box = GTK_COMBO_BOX (user_data); GtkComboBoxPrivate *priv = combo_box->priv; GtkWidget *menu_item; - if (priv->wrap_width > 0 || priv->cell_view == NULL) + if (priv->wrap_width > 0 || priv->cell_view == NULL) gtk_combo_box_menu_position_below (menu, x, y, push_in, user_data); else { /* FIXME handle nested menus better */ menu_item = gtk_menu_get_active (GTK_MENU (priv->popup_widget)); if (menu_item) - gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->popup_widget), - menu_item); + gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->popup_widget), + menu_item); gtk_combo_box_menu_position_over (menu, x, y, push_in, user_data); } @@ -1851,11 +1851,11 @@ gtk_combo_box_menu_position (GtkMenu *menu, } static void -gtk_combo_box_list_position (GtkComboBox *combo_box, - gint *x, - gint *y, - gint *width, - gint *height) +gtk_combo_box_list_position (GtkComboBox *combo_box, + gint *x, + gint *y, + gint *width, + gint *height) { GtkComboBoxPrivate *priv = combo_box->priv; GtkAllocation allocation; @@ -1889,18 +1889,18 @@ gtk_combo_box_list_position (GtkComboBox *combo_box, hpolicy = vpolicy = GTK_POLICY_NEVER; gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), - hpolicy, vpolicy); + hpolicy, vpolicy); if (combo_box->priv->popup_fixed_width) { gtk_widget_get_preferred_size (priv->scrolled_window, &popup_req, NULL); if (popup_req.width > *width) - { - hpolicy = GTK_POLICY_ALWAYS; - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), - hpolicy, vpolicy); - } + { + hpolicy = GTK_POLICY_ALWAYS; + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), + hpolicy, vpolicy); + } } else { @@ -1909,13 +1909,13 @@ gtk_combo_box_list_position (GtkComboBox *combo_box, gtk_widget_get_preferred_size (priv->scrolled_window, NULL, &popup_req); if (popup_req.width > *width) - { - hpolicy = GTK_POLICY_NEVER; - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), - hpolicy, vpolicy); + { + hpolicy = GTK_POLICY_NEVER; + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), + hpolicy, vpolicy); - *width = popup_req.width; - } + *width = popup_req.width; + } } *height = popup_req.height; @@ -1931,7 +1931,7 @@ gtk_combo_box_list_position (GtkComboBox *combo_box, *x = monitor.x; else if (*x + *width > monitor.x + monitor.width) *x = monitor.x + monitor.width - *width; - + if (*y + allocation.height + *height <= monitor.y + monitor.height) *y += allocation.height; else if (*y - *height >= monitor.y) @@ -1941,7 +1941,7 @@ gtk_combo_box_list_position (GtkComboBox *combo_box, *y += allocation.height; *height = monitor.y + monitor.height - *y; } - else + else { *height = *y - monitor.y; *y = monitor.y; @@ -1950,27 +1950,27 @@ gtk_combo_box_list_position (GtkComboBox *combo_box, if (popup_req.height > *height) { vpolicy = GTK_POLICY_ALWAYS; - + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window), - hpolicy, vpolicy); + hpolicy, vpolicy); } -} +} static gboolean cell_view_is_sensitive (GtkCellView *cell_view) { GList *cells, *list; gboolean sensitive; - + cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (cell_view)); sensitive = FALSE; for (list = cells; list; list = list->next) { g_object_get (list->data, "sensitive", &sensitive, NULL); - + if (sensitive) - break; + break; } g_list_free (cells); @@ -1979,7 +1979,7 @@ cell_view_is_sensitive (GtkCellView *cell_view) static gboolean tree_column_row_is_sensitive (GtkComboBox *combo_box, - GtkTreeIter *iter) + GtkTreeIter *iter) { GtkComboBoxPrivate *priv = combo_box->priv; GList *cells, *list; @@ -1992,12 +1992,12 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box, { if (priv->row_separator_func (priv->model, iter, priv->row_separator_data)) - return FALSE; + return FALSE; } gtk_tree_view_column_cell_set_cell_data (priv->column, - priv->model, - iter, FALSE, FALSE); + priv->model, + iter, FALSE, FALSE); cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->column)); @@ -2005,9 +2005,9 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box, for (list = cells; list; list = list->next) { g_object_get (list->data, "sensitive", &sensitive, NULL); - + if (sensitive) - break; + break; } g_list_free (cells); @@ -2016,7 +2016,7 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box, static void update_menu_sensitivity (GtkComboBox *combo_box, - GtkWidget *menu) + GtkWidget *menu) { GtkComboBoxPrivate *priv = combo_box->priv; GList *children, *child; @@ -2035,42 +2035,42 @@ update_menu_sensitivity (GtkComboBox *combo_box, cell_view = gtk_bin_get_child (GTK_BIN (item)); if (!GTK_IS_CELL_VIEW (cell_view)) - continue; - + continue; + submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (item)); if (submenu != NULL) - { - gtk_widget_set_sensitive (item, TRUE); - update_menu_sensitivity (combo_box, submenu); - } + { + gtk_widget_set_sensitive (item, TRUE); + update_menu_sensitivity (combo_box, submenu); + } else - { - sensitive = cell_view_is_sensitive (GTK_CELL_VIEW (cell_view)); - - if (menu != priv->popup_widget && child == children) - { - separator = GTK_WIDGET (child->next->data); - g_object_set (item, "visible", sensitive, NULL); - g_object_set (separator, "visible", sensitive, NULL); - } - else - gtk_widget_set_sensitive (item, sensitive); - } + { + sensitive = cell_view_is_sensitive (GTK_CELL_VIEW (cell_view)); + + if (menu != priv->popup_widget && child == children) + { + separator = GTK_WIDGET (child->next->data); + g_object_set (item, "visible", sensitive, NULL); + g_object_set (separator, "visible", sensitive, NULL); + } + else + gtk_widget_set_sensitive (item, sensitive); + } } g_list_free (children); } -static void +static void gtk_combo_box_menu_popup (GtkComboBox *combo_box, - guint button, - guint32 activate_time) + guint button, + guint32 activate_time) { GtkComboBoxPrivate *priv = combo_box->priv; GtkTreePath *path; gint active_item; gint width, min_width, nat_width; - + update_menu_sensitivity (combo_box, priv->popup_widget); active_item = -1; @@ -2079,14 +2079,14 @@ gtk_combo_box_menu_popup (GtkComboBox *combo_box, path = gtk_tree_row_reference_get_path (priv->active_row); active_item = gtk_tree_path_get_indices (path)[0]; gtk_tree_path_free (path); - + if (priv->add_tearoffs) - active_item++; + active_item++; } /* FIXME handle nested menus better */ gtk_menu_set_active (GTK_MENU (priv->popup_widget), active_item); - + if (priv->wrap_width == 0) { GtkAllocation allocation; @@ -2097,24 +2097,24 @@ gtk_combo_box_menu_popup (GtkComboBox *combo_box, gtk_widget_get_preferred_width (priv->popup_widget, &min_width, &nat_width); if (combo_box->priv->popup_fixed_width) - width = MAX (width, min_width); + width = MAX (width, min_width); else - width = MAX (width, nat_width); + width = MAX (width, nat_width); gtk_widget_set_size_request (priv->popup_widget, width, -1); } - + gtk_menu_popup (GTK_MENU (priv->popup_widget), - NULL, NULL, - gtk_combo_box_menu_position, combo_box, - button, activate_time); + NULL, NULL, + gtk_combo_box_menu_position, combo_box, + button, activate_time); } static gboolean popup_grab_on_window (GdkWindow *window, GdkDevice *keyboard, GdkDevice *pointer, - guint32 activate_time) + guint32 activate_time) { if (keyboard && gdk_device_grab (keyboard, window, @@ -2142,8 +2142,8 @@ popup_grab_on_window (GdkWindow *window, /** * gtk_combo_box_popup: * @combo_box: a #GtkComboBox - * - * Pops up the menu or dropdown list of @combo_box. + * + * Pops up the menu or dropdown list of @combo_box. * * This function is mostly intended for use by accessibility technologies; * applications should have little use for it. @@ -2207,7 +2207,7 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box, if (GTK_IS_MENU (priv->popup_widget)) { - gtk_combo_box_menu_popup (combo_box, + gtk_combo_box_menu_popup (combo_box, priv->activate_button, priv->activate_time); return; @@ -2215,13 +2215,13 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box, toplevel = gtk_widget_get_toplevel (GTK_WIDGET (combo_box)); if (GTK_IS_WINDOW (toplevel)) - gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)), - GTK_WINDOW (priv->popup_window)); + gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (toplevel)), + GTK_WINDOW (priv->popup_window)); gtk_widget_show_all (priv->scrolled_window); gtk_combo_box_list_position (combo_box, &x, &y, &width, &height); - - gtk_widget_set_size_request (priv->popup_window, width, height); + + gtk_widget_set_size_request (priv->popup_window, width, height); gtk_window_move (GTK_WINDOW (priv->popup_window), x, y); if (gtk_tree_row_reference_valid (priv->active_row)) @@ -2229,20 +2229,20 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box, path = gtk_tree_row_reference_get_path (priv->active_row); ppath = gtk_tree_path_copy (path); if (gtk_tree_path_up (ppath)) - gtk_tree_view_expand_to_path (GTK_TREE_VIEW (priv->tree_view), - ppath); + gtk_tree_view_expand_to_path (GTK_TREE_VIEW (priv->tree_view), + ppath); gtk_tree_path_free (ppath); } - gtk_tree_view_set_hover_expand (GTK_TREE_VIEW (priv->tree_view), - TRUE); - + gtk_tree_view_set_hover_expand (GTK_TREE_VIEW (priv->tree_view), + TRUE); + /* popup */ gtk_widget_show (priv->popup_window); if (path) { gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->tree_view), - path, NULL, FALSE); + path, NULL, FALSE); gtk_tree_path_free (path); } @@ -2254,7 +2254,7 @@ gtk_combo_box_popup_for_device (GtkComboBox *combo_box, gtk_widget_grab_focus (priv->tree_view); if (!popup_grab_on_window (gtk_widget_get_window (priv->popup_window), - keyboard, pointer, time)) + keyboard, pointer, time)) { gtk_widget_hide (priv->popup_window); return; @@ -2305,7 +2305,7 @@ gtk_combo_box_real_popdown (GtkComboBox *combo_box) /** * gtk_combo_box_popdown: * @combo_box: a #GtkComboBox - * + * * Hides the menu or dropdown list of @combo_box. * * This function is mostly intended for use by accessibility technologies; @@ -2338,21 +2338,21 @@ gtk_combo_box_popdown (GtkComboBox *combo_box) priv->grab_keyboard = NULL; } -#define GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON \ - gtk_widget_get_preferred_size (combo_box->priv->button, \ - &req, NULL); \ - \ - if (is_rtl) \ - child.x = allocation->x + border.right; \ - else \ - child.x = allocation->x + allocation->width - req.width - border.left; \ - \ - child.y = allocation->y + border.top; \ - child.width = req.width; \ - child.height = allocation->height - (border.top + border.bottom); \ - child.width = MAX (1, child.width); \ - child.height = MAX (1, child.height); \ - \ +#define GTK_COMBO_BOX_SIZE_ALLOCATE_BUTTON \ + gtk_widget_get_preferred_size (combo_box->priv->button, \ + &req, NULL); \ + \ + if (is_rtl) \ + child.x = allocation->x + border.right; \ + else \ + child.x = allocation->x + allocation->width - req.width - border.left; \ + \ + child.y = allocation->y + border.top; \ + child.width = req.width; \ + child.height = allocation->height - (border.top + border.bottom); \ + child.width = MAX (1, child.width); \ + child.height = MAX (1, child.height); \ + \ gtk_widget_size_allocate (combo_box->priv->button, &child); @@ -2374,15 +2374,15 @@ gtk_combo_box_size_allocate (GtkWidget *widget, get_widget_border (widget, &border); gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); + "focus-line-width", &focus_width, + "focus-padding", &focus_pad, + NULL); if (!priv->tree_view) { if (priv->cell_view) { - GtkBorder button_border; + GtkBorder button_border; gint width; guint border_width; @@ -2396,30 +2396,30 @@ gtk_combo_box_size_allocate (GtkWidget *widget, /* set some things ready */ border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->button)); - get_widget_border (priv->button, &button_border); + get_widget_border (priv->button, &button_border); child.x = allocation->x; child.y = allocation->y; - width = allocation->width; - child.height = allocation->height; - - if (!priv->is_cell_renderer) - { - child.x += border_width + button_border.left + focus_width + focus_pad; - child.y += border_width + button_border.top + focus_width + focus_pad; - width -= (2 * (border_width + focus_width + focus_pad)) + + width = allocation->width; + child.height = allocation->height; + + if (!priv->is_cell_renderer) + { + child.x += border_width + button_border.left + focus_width + focus_pad; + child.y += border_width + button_border.top + focus_width + focus_pad; + width -= (2 * (border_width + focus_width + focus_pad)) + button_border.left + button_border.right; - child.height -= (2 * (border_width + focus_width + focus_pad)) + + child.height -= (2 * (border_width + focus_width + focus_pad)) + button_border.top + button_border.bottom; - } + } /* handle the children */ gtk_widget_get_preferred_size (priv->arrow, &req, NULL); child.width = req.width; if (!is_rtl) child.x += width - req.width; - child.width = MAX (1, child.width); - child.height = MAX (1, child.height); + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (priv->arrow, &child); if (is_rtl) child.x += req.width; @@ -2427,22 +2427,22 @@ gtk_combo_box_size_allocate (GtkWidget *widget, child.width = req.width; if (!is_rtl) child.x -= req.width; - child.width = MAX (1, child.width); - child.height = MAX (1, child.height); + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (priv->separator, &child); if (is_rtl) { child.x += req.width; - child.width = allocation->x + allocation->width - - (border_width + button_border.right + focus_width + focus_pad) - - child.x; + child.width = allocation->x + allocation->width + - (border_width + button_border.right + focus_width + focus_pad) + - child.x; } - else + else { child.width = child.x; - child.x = allocation->x - + border_width + button_border.left + focus_width + focus_pad; + child.x = allocation->x + + border_width + button_border.left + focus_width + focus_pad; child.width -= child.x; } @@ -2458,21 +2458,21 @@ gtk_combo_box_size_allocate (GtkWidget *widget, width = combo_box_allocation.width; gtk_widget_set_size_request (priv->popup_widget, -1, -1); - if (combo_box->priv->popup_fixed_width) - gtk_widget_get_preferred_width (priv->popup_widget, &menu_width, NULL); - else - gtk_widget_get_preferred_width (priv->popup_widget, NULL, &menu_width); + if (combo_box->priv->popup_fixed_width) + gtk_widget_get_preferred_width (priv->popup_widget, &menu_width, NULL); + else + gtk_widget_get_preferred_width (priv->popup_widget, NULL, &menu_width); gtk_widget_set_size_request (priv->popup_widget, - MAX (width, menu_width), -1); + MAX (width, menu_width), -1); } /* reposition the menu after giving it a new width */ gtk_menu_reposition (GTK_MENU (priv->popup_widget)); } - child.width = MAX (1, child.width); - child.height = MAX (1, child.height); + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (child_widget, &child); } else @@ -2485,8 +2485,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, child.x = allocation->x + border.left; child.y = allocation->y + border.top; child.width = allocation->width - req.width - (border.left + border.right); - child.width = MAX (1, child.width); - child.height = MAX (1, child.height); + child.width = MAX (1, child.width); + child.height = MAX (1, child.height); gtk_widget_size_allocate (child_widget, &child); } } @@ -2519,10 +2519,10 @@ gtk_combo_box_size_allocate (GtkWidget *widget, /* the sample */ if (priv->has_frame) { - GtkBorder frame_border; + GtkBorder frame_border; border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame)); - get_widget_border (priv->cell_view_frame, &frame_border); + get_widget_border (priv->cell_view_frame, &frame_border); child.x += border_width + frame_border.left; child.y += border_width + frame_border.right; @@ -2546,10 +2546,8 @@ gtk_combo_box_size_allocate (GtkWidget *widget, gtk_widget_set_size_request (priv->popup_window, width, height); } - child.width = MAX (1, child.width); child.height = MAX (1, child.height); - gtk_widget_size_allocate (child_widget, &child); } } @@ -2564,13 +2562,13 @@ gtk_combo_box_unset_model (GtkComboBox *combo_box) if (priv->model) { g_signal_handler_disconnect (priv->model, - priv->inserted_id); + priv->inserted_id); g_signal_handler_disconnect (priv->model, - priv->deleted_id); + priv->deleted_id); g_signal_handler_disconnect (priv->model, - priv->reordered_id); + priv->reordered_id); g_signal_handler_disconnect (priv->model, - priv->changed_id); + priv->changed_id); } if (priv->model) @@ -2602,9 +2600,9 @@ gtk_combo_box_forall (GtkContainer *container, if (include_internals) { if (priv->button) - (* callback) (priv->button, callback_data); + (* callback) (priv->button, callback_data); if (priv->cell_view_frame) - (* callback) (priv->cell_view_frame, callback_data); + (* callback) (priv->cell_view_frame, callback_data); } child = gtk_bin_get_child (GTK_BIN (container)); @@ -2612,7 +2610,7 @@ gtk_combo_box_forall (GtkContainer *container, (* callback) (child, callback_data); } -static void +static void gtk_combo_box_child_show (GtkWidget *widget, GtkComboBox *combo_box) { @@ -2622,7 +2620,7 @@ gtk_combo_box_child_show (GtkWidget *widget, g_object_notify (G_OBJECT (combo_box), "popup-shown"); } -static void +static void gtk_combo_box_child_hide (GtkWidget *widget, GtkComboBox *combo_box) { @@ -2657,12 +2655,12 @@ gtk_combo_box_draw (GtkWidget *widget, } gtk_container_propagate_draw (GTK_CONTAINER (widget), - priv->button, cr); + priv->button, cr); if (priv->tree_view && priv->cell_view_frame) { gtk_container_propagate_draw (GTK_CONTAINER (widget), - priv->cell_view_frame, cr); + priv->cell_view_frame, cr); } gtk_container_propagate_draw (GTK_CONTAINER (widget), @@ -2683,51 +2681,51 @@ typedef struct { static gboolean path_visible (GtkTreeView *view, - GtkTreePath *path) + GtkTreePath *path) { GtkRBTree *tree; GtkRBNode *node; - - /* Note that we rely on the fact that collapsed rows don't have nodes + + /* Note that we rely on the fact that collapsed rows don't have nodes */ return _gtk_tree_view_find_node (view, path, &tree, &node); } static gboolean tree_next_func (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data) { SearchData *search_data = (SearchData *)data; - if (search_data->found) + if (search_data->found) { if (!tree_column_row_is_sensitive (search_data->combo, iter)) - return FALSE; - + return FALSE; + if (search_data->visible && - !path_visible (GTK_TREE_VIEW (search_data->combo->priv->tree_view), path)) - return FALSE; + !path_visible (GTK_TREE_VIEW (search_data->combo->priv->tree_view), path)) + return FALSE; search_data->set = TRUE; search_data->iter = *iter; return TRUE; } - + if (gtk_tree_path_compare (path, search_data->path) == 0) search_data->found = TRUE; - + return FALSE; } static gboolean tree_next (GtkComboBox *combo, - GtkTreeModel *model, - GtkTreeIter *iter, - GtkTreeIter *next, - gboolean visible) + GtkTreeModel *model, + GtkTreeIter *iter, + GtkTreeIter *next, + gboolean visible) { SearchData search_data; @@ -2738,7 +2736,7 @@ tree_next (GtkComboBox *combo, search_data.set = FALSE; gtk_tree_model_foreach (model, tree_next_func, &search_data); - + *next = search_data.iter; gtk_tree_path_free (search_data.path); @@ -2748,9 +2746,9 @@ tree_next (GtkComboBox *combo, static gboolean tree_prev_func (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data) { SearchData *search_data = (SearchData *)data; @@ -2759,26 +2757,26 @@ tree_prev_func (GtkTreeModel *model, search_data->found = TRUE; return TRUE; } - + if (!tree_column_row_is_sensitive (search_data->combo, iter)) return FALSE; - + if (search_data->visible && !path_visible (GTK_TREE_VIEW (search_data->combo->priv->tree_view), path)) - return FALSE; - + return FALSE; + search_data->set = TRUE; search_data->iter = *iter; - - return FALSE; + + return FALSE; } static gboolean tree_prev (GtkComboBox *combo, - GtkTreeModel *model, - GtkTreeIter *iter, - GtkTreeIter *prev, - gboolean visible) + GtkTreeModel *model, + GtkTreeIter *iter, + GtkTreeIter *prev, + gboolean visible) { SearchData search_data; @@ -2789,7 +2787,7 @@ tree_prev (GtkComboBox *combo, search_data.set = FALSE; gtk_tree_model_foreach (model, tree_prev_func, &search_data); - + *prev = search_data.iter; gtk_tree_path_free (search_data.path); @@ -2799,32 +2797,32 @@ tree_prev (GtkComboBox *combo, static gboolean tree_last_func (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data) { SearchData *search_data = (SearchData *)data; if (!tree_column_row_is_sensitive (search_data->combo, iter)) return FALSE; - - /* Note that we rely on the fact that collapsed rows don't have nodes + + /* Note that we rely on the fact that collapsed rows don't have nodes */ if (search_data->visible && !path_visible (GTK_TREE_VIEW (search_data->combo->priv->tree_view), path)) - return FALSE; - + return FALSE; + search_data->set = TRUE; search_data->iter = *iter; - - return FALSE; + + return FALSE; } static gboolean tree_last (GtkComboBox *combo, - GtkTreeModel *model, - GtkTreeIter *last, - gboolean visible) + GtkTreeModel *model, + GtkTreeIter *last, + gboolean visible) { SearchData search_data; @@ -2833,51 +2831,51 @@ tree_last (GtkComboBox *combo, search_data.set = FALSE; gtk_tree_model_foreach (model, tree_last_func, &search_data); - + *last = search_data.iter; - return search_data.set; + return search_data.set; } static gboolean tree_first_func (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer data) { SearchData *search_data = (SearchData *)data; if (!tree_column_row_is_sensitive (search_data->combo, iter)) return FALSE; - + if (search_data->visible && !path_visible (GTK_TREE_VIEW (search_data->combo->priv->tree_view), path)) return FALSE; - + search_data->set = TRUE; search_data->iter = *iter; - + return TRUE; } static gboolean tree_first (GtkComboBox *combo, - GtkTreeModel *model, - GtkTreeIter *first, - gboolean visible) + GtkTreeModel *model, + GtkTreeIter *first, + gboolean visible) { SearchData search_data; - + search_data.combo = combo; search_data.visible = visible; search_data.set = FALSE; gtk_tree_model_foreach (model, tree_first_func, &search_data); - + *first = search_data.iter; - return search_data.set; + return search_data.set; } static gboolean @@ -2891,14 +2889,14 @@ gtk_combo_box_scroll_event (GtkWidget *widget, if (!gtk_combo_box_get_active_iter (combo_box, &iter)) return TRUE; - + if (event->direction == GDK_SCROLL_UP) - found = tree_prev (combo_box, combo_box->priv->model, - &iter, &new_iter, FALSE); + found = tree_prev (combo_box, combo_box->priv->model, + &iter, &new_iter, FALSE); else - found = tree_next (combo_box, combo_box->priv->model, - &iter, &new_iter, FALSE); - + found = tree_next (combo_box, combo_box->priv->model, + &iter, &new_iter, FALSE); + if (found) gtk_combo_box_set_active_iter (combo_box, &new_iter); @@ -2908,11 +2906,10 @@ gtk_combo_box_scroll_event (GtkWidget *widget, /* * menu style */ - -static gboolean +static gboolean gtk_combo_box_row_separator_func (GtkTreeModel *model, - GtkTreeIter *iter, - GtkComboBox *combo) + GtkTreeIter *iter, + GtkComboBox *combo) { GtkComboBoxPrivate *priv = combo->priv; @@ -2922,13 +2919,13 @@ gtk_combo_box_row_separator_func (GtkTreeModel *model, return FALSE; } -static gboolean +static gboolean gtk_combo_box_header_func (GtkTreeModel *model, - GtkTreeIter *iter, - GtkComboBox *combo) + GtkTreeIter *iter, + GtkComboBox *combo) { /* Every submenu has a selectable header, however we - * can expose a method to make that configurable by + * can expose a method to make that configurable by * the user (like row_separator_func is done) */ return TRUE; } @@ -2947,7 +2944,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box, { priv->button = gtk_toggle_button_new (); gtk_button_set_focus_on_click (GTK_BUTTON (priv->button), - priv->focus_on_click); + priv->focus_on_click); g_signal_connect (priv->button, "toggled", G_CALLBACK (gtk_combo_box_button_toggled), combo_box); @@ -2969,7 +2966,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box, { priv->button = gtk_toggle_button_new (); gtk_button_set_focus_on_click (GTK_BUTTON (priv->button), - priv->focus_on_click); + priv->focus_on_click); g_signal_connect (priv->button, "toggled", G_CALLBACK (gtk_combo_box_button_toggled), combo_box); @@ -2985,8 +2982,8 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box, G_CALLBACK (gtk_combo_box_menu_button_press), combo_box); g_signal_connect (priv->button, "state-flags-changed", - G_CALLBACK (gtk_combo_box_button_state_flags_changed), - combo_box); + G_CALLBACK (gtk_combo_box_button_state_flags_changed), + combo_box); /* create our funky menu */ menu = _gtk_tree_menu_new_with_area (priv->area); @@ -2997,25 +2994,25 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box, _gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (menu), priv->wrap_width); _gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (menu), priv->row_column); _gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (menu), priv->col_column); - _gtk_tree_menu_set_tearoff (GTK_TREE_MENU (menu), - combo_box->priv->add_tearoffs); + _gtk_tree_menu_set_tearoff (GTK_TREE_MENU (menu), + combo_box->priv->add_tearoffs); g_signal_connect (menu, "menu-activate", - G_CALLBACK (gtk_combo_box_menu_activate), combo_box); + G_CALLBACK (gtk_combo_box_menu_activate), combo_box); /* Chain our row_separator_func through */ _gtk_tree_menu_set_row_separator_func (GTK_TREE_MENU (menu), - (GtkTreeViewRowSeparatorFunc)gtk_combo_box_row_separator_func, - combo_box, NULL); + (GtkTreeViewRowSeparatorFunc)gtk_combo_box_row_separator_func, + combo_box, NULL); _gtk_tree_menu_set_header_func (GTK_TREE_MENU (menu), - (GtkTreeMenuHeaderFunc)gtk_combo_box_header_func, - combo_box, NULL); + (GtkTreeMenuHeaderFunc)gtk_combo_box_header_func, + combo_box, NULL); gtk_widget_set_name (menu, "gtk-combobox-popup-menu"); - + g_signal_connect (menu, "key-press-event", - G_CALLBACK (gtk_combo_box_menu_key_press), combo_box); + G_CALLBACK (gtk_combo_box_menu_key_press), combo_box); gtk_combo_box_set_popup_widget (combo_box, menu); gtk_combo_box_update_title (combo_box); @@ -3064,9 +3061,9 @@ gtk_combo_box_menu_button_press (GtkWidget *widget, if (GTK_IS_MENU (priv->popup_widget) && event->type == GDK_BUTTON_PRESS && event->button == 1) { - if (priv->focus_on_click && - !gtk_widget_has_focus (priv->button)) - gtk_widget_grab_focus (priv->button); + if (priv->focus_on_click && + !gtk_widget_has_focus (priv->button)) + gtk_widget_grab_focus (priv->button); gtk_combo_box_menu_popup (combo_box, event->button, event->time); @@ -3078,8 +3075,8 @@ gtk_combo_box_menu_button_press (GtkWidget *widget, static void gtk_combo_box_menu_activate (GtkWidget *menu, - const gchar *path, - GtkComboBox *combo_box) + const gchar *path, + GtkComboBox *combo_box) { GtkTreeIter iter; @@ -3128,9 +3125,9 @@ gtk_combo_box_update_sensitivity (GtkComboBox *combo_box) static void gtk_combo_box_model_row_inserted (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) { GtkComboBox *combo_box = GTK_COMBO_BOX (user_data); @@ -3142,8 +3139,8 @@ gtk_combo_box_model_row_inserted (GtkTreeModel *model, static void gtk_combo_box_model_row_deleted (GtkTreeModel *model, - GtkTreePath *path, - gpointer user_data) + GtkTreePath *path, + gpointer user_data) { GtkComboBox *combo_box = GTK_COMBO_BOX (user_data); GtkComboBoxPrivate *priv = combo_box->priv; @@ -3151,7 +3148,7 @@ gtk_combo_box_model_row_deleted (GtkTreeModel *model, if (!gtk_tree_row_reference_valid (priv->active_row)) { if (priv->cell_view) - gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (priv->cell_view), NULL); + gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (priv->cell_view), NULL); g_signal_emit (combo_box, combo_box_signals[CHANGED], 0); } @@ -3163,19 +3160,19 @@ gtk_combo_box_model_row_deleted (GtkTreeModel *model, static void gtk_combo_box_model_rows_reordered (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gint *new_order, - gpointer user_data) + GtkTreePath *path, + GtkTreeIter *iter, + gint *new_order, + gpointer user_data) { gtk_tree_row_reference_reordered (G_OBJECT (user_data), path, iter, new_order); } - + static void gtk_combo_box_model_row_changed (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) { GtkComboBox *combo_box = GTK_COMBO_BOX (user_data); GtkComboBoxPrivate *priv = combo_box->priv; @@ -3186,11 +3183,11 @@ gtk_combo_box_model_row_changed (GtkTreeModel *model, { active_path = gtk_tree_row_reference_get_path (priv->active_row); if (gtk_tree_path_compare (path, active_path) == 0 && - priv->cell_view) - gtk_widget_queue_resize (GTK_WIDGET (priv->cell_view)); + priv->cell_view) + gtk_widget_queue_resize (GTK_WIDGET (priv->cell_view)); gtk_tree_path_free (active_path); } - + if (priv->tree_view) gtk_combo_box_list_row_changed (model, path, iter, user_data); } @@ -3205,7 +3202,7 @@ list_popup_resize_idle (gpointer user_data) if (priv->tree_view && gtk_widget_get_mapped (priv->popup_window)) { gtk_combo_box_list_position (combo_box, &x, &y, &width, &height); - + gtk_widget_set_size_request (priv->popup_window, width, height); gtk_window_move (GTK_WINDOW (priv->popup_window), x, y); } @@ -3221,18 +3218,18 @@ gtk_combo_box_list_popup_resize (GtkComboBox *combo_box) GtkComboBoxPrivate *priv = combo_box->priv; if (!priv->resize_idle_id) - priv->resize_idle_id = + priv->resize_idle_id = gdk_threads_add_idle (list_popup_resize_idle, combo_box); } static void gtk_combo_box_model_row_expanded (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gpointer user_data) + GtkTreePath *path, + GtkTreeIter *iter, + gpointer user_data) { GtkComboBox *combo_box = GTK_COMBO_BOX (user_data); - + gtk_combo_box_list_popup_resize (combo_box); } @@ -3280,50 +3277,50 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box) gdk_rgba_free (color); priv->box = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->box), - FALSE); + gtk_event_box_set_visible_window (GTK_EVENT_BOX (priv->box), + FALSE); if (priv->has_frame) - { - priv->cell_view_frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (priv->cell_view_frame), - GTK_SHADOW_IN); - } - else - { - combo_box->priv->cell_view_frame = gtk_event_box_new (); - gtk_event_box_set_visible_window (GTK_EVENT_BOX (combo_box->priv->cell_view_frame), - FALSE); - } + { + priv->cell_view_frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (priv->cell_view_frame), + GTK_SHADOW_IN); + } + else + { + combo_box->priv->cell_view_frame = gtk_event_box_new (); + gtk_event_box_set_visible_window (GTK_EVENT_BOX (combo_box->priv->cell_view_frame), + FALSE); + } gtk_widget_set_parent (priv->cell_view_frame, - gtk_widget_get_parent (child)); + gtk_widget_get_parent (child)); gtk_container_add (GTK_CONTAINER (priv->cell_view_frame), priv->box); gtk_widget_show_all (priv->cell_view_frame); g_signal_connect (priv->box, "button-press-event", - G_CALLBACK (gtk_combo_box_list_button_pressed), - combo_box); + G_CALLBACK (gtk_combo_box_list_button_pressed), + combo_box); } priv->tree_view = gtk_tree_view_new (); sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view)); gtk_tree_selection_set_mode (sel, GTK_SELECTION_BROWSE); gtk_tree_selection_set_select_function (sel, - gtk_combo_box_list_select_func, - NULL, NULL); + gtk_combo_box_list_select_func, + NULL, NULL); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree_view), FALSE); gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (priv->tree_view), - TRUE); + TRUE); - gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (priv->tree_view), - (GtkTreeViewRowSeparatorFunc)gtk_combo_box_row_separator_func, - combo_box, NULL); + gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (priv->tree_view), + (GtkTreeViewRowSeparatorFunc)gtk_combo_box_row_separator_func, + combo_box, NULL); if (priv->model) gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), priv->model); - + priv->column = gtk_tree_view_column_new_with_area (priv->area); gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view), priv->column); @@ -3333,7 +3330,7 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box) path = gtk_tree_row_reference_get_path (priv->active_row); gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->tree_view), - path, NULL, FALSE); + path, NULL, FALSE); gtk_tree_path_free (path); } @@ -3347,11 +3344,11 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box) G_CALLBACK (gtk_combo_box_list_enter_notify), combo_box); g_signal_connect (priv->tree_view, "row-expanded", - G_CALLBACK (gtk_combo_box_model_row_expanded), - combo_box); + G_CALLBACK (gtk_combo_box_model_row_expanded), + combo_box); g_signal_connect (priv->tree_view, "row-collapsed", - G_CALLBACK (gtk_combo_box_model_row_expanded), - combo_box); + G_CALLBACK (gtk_combo_box_model_row_expanded), + combo_box); g_signal_connect (priv->popup_window, "button-press-event", G_CALLBACK (gtk_combo_box_list_button_pressed), combo_box); @@ -3390,23 +3387,23 @@ gtk_combo_box_list_destroy (GtkComboBox *combo_box) NULL); g_signal_handlers_disconnect_matched (priv->popup_window, - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, - gtk_combo_box_child_show, - NULL); + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, + gtk_combo_box_child_show, + NULL); g_signal_handlers_disconnect_matched (priv->popup_window, - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, - gtk_combo_box_child_hide, - NULL); - + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, + gtk_combo_box_child_hide, + NULL); + if (priv->box) g_signal_handlers_disconnect_matched (priv->box, - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, - gtk_combo_box_list_button_pressed, - NULL); + G_SIGNAL_MATCH_DATA, + 0, 0, NULL, + gtk_combo_box_list_button_pressed, + NULL); /* destroy things (unparent will kill the latest ref from us) * last unref on button will destroy the arrow @@ -3470,7 +3467,7 @@ gtk_combo_box_list_button_pressed (GtkWidget *widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button))) return FALSE; - if (priv->focus_on_click && + if (priv->focus_on_click && !gtk_widget_has_focus (priv->button)) gtk_widget_grab_focus (priv->button); @@ -3480,9 +3477,9 @@ gtk_combo_box_list_button_pressed (GtkWidget *widget, priv->auto_scroll = FALSE; if (priv->scroll_timer == 0) - priv->scroll_timer = gdk_threads_add_timeout (SCROLL_TIME, - (GSourceFunc) gtk_combo_box_list_scroll_timeout, - combo_box); + priv->scroll_timer = gdk_threads_add_timeout (SCROLL_TIME, + (GSourceFunc) gtk_combo_box_list_scroll_timeout, + combo_box); priv->popup_in_progress = TRUE; @@ -3511,8 +3508,8 @@ gtk_combo_box_list_button_released (GtkWidget *widget, priv->popup_in_progress = FALSE; } - gtk_tree_view_set_hover_expand (GTK_TREE_VIEW (priv->tree_view), - FALSE); + gtk_tree_view_set_hover_expand (GTK_TREE_VIEW (priv->tree_view), + FALSE); if (priv->scroll_timer) { g_source_remove (priv->scroll_timer); @@ -3521,8 +3518,8 @@ gtk_combo_box_list_button_released (GtkWidget *widget, if (ewidget != priv->tree_view) { - if ((ewidget == priv->button || - ewidget == priv->box) && + if ((ewidget == priv->button || + ewidget == priv->box) && !popup_in_progress && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button))) { @@ -3563,8 +3560,8 @@ gtk_combo_box_list_button_released (GtkWidget *widget, static gboolean gtk_combo_box_menu_key_press (GtkWidget *widget, - GdkEventKey *event, - gpointer data) + GdkEventKey *event, + gpointer data) { GtkComboBox *combo_box = GTK_COMBO_BOX (data); @@ -3588,22 +3585,22 @@ gtk_combo_box_list_key_press (GtkWidget *widget, GtkTreeIter iter; if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_ISO_Enter || event->keyval == GDK_KEY_KP_Enter || - event->keyval == GDK_KEY_space || event->keyval == GDK_KEY_KP_Space) + event->keyval == GDK_KEY_space || event->keyval == GDK_KEY_KP_Space) { GtkTreeModel *model = NULL; - + gtk_combo_box_popdown (combo_box); - + if (combo_box->priv->model) { - GtkTreeSelection *sel; + GtkTreeSelection *sel; - sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (combo_box->priv->tree_view)); + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (combo_box->priv->tree_view)); - if (gtk_tree_selection_get_selected (sel, &model, &iter)) - gtk_combo_box_set_active_iter (combo_box, &iter); + if (gtk_tree_selection_get_selected (sel, &model, &iter)) + gtk_combo_box_set_active_iter (combo_box, &iter); } - + return TRUE; } @@ -3620,8 +3617,8 @@ gtk_combo_box_list_key_press (GtkWidget *widget, static void gtk_combo_box_list_auto_scroll (GtkComboBox *combo_box, - gint x, - gint y) + gint x, + gint y) { GtkAdjustment *adj; GtkAllocation allocation; @@ -3634,34 +3631,34 @@ gtk_combo_box_list_auto_scroll (GtkComboBox *combo_box, if (adj && adj->upper - adj->lower > adj->page_size) { if (x <= allocation.x && - adj->lower < adj->value) - { - value = adj->value - (allocation.x - x + 1); - gtk_adjustment_set_value (adj, value); - } + adj->lower < adj->value) + { + value = adj->value - (allocation.x - x + 1); + gtk_adjustment_set_value (adj, value); + } else if (x >= allocation.x + allocation.width && - adj->upper - adj->page_size > adj->value) - { - value = adj->value + (x - allocation.x - allocation.width + 1); - gtk_adjustment_set_value (adj, MAX (value, 0.0)); - } + adj->upper - adj->page_size > adj->value) + { + value = adj->value + (x - allocation.x - allocation.width + 1); + gtk_adjustment_set_value (adj, MAX (value, 0.0)); + } } adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (combo_box->priv->scrolled_window)); if (adj && adj->upper - adj->lower > adj->page_size) { if (y <= allocation.y && - adj->lower < adj->value) - { - value = adj->value - (allocation.y - y + 1); - gtk_adjustment_set_value (adj, value); - } + adj->lower < adj->value) + { + value = adj->value - (allocation.y - y + 1); + gtk_adjustment_set_value (adj, value); + } else if (y >= allocation.height && - adj->upper - adj->page_size > adj->value) - { - value = adj->value + (y - allocation.height + 1); - gtk_adjustment_set_value (adj, MAX (value, 0.0)); - } + adj->upper - adj->page_size > adj->value) + { + value = adj->value + (y - allocation.height + 1); + gtk_adjustment_set_value (adj, MAX (value, 0.0)); + } } } @@ -3682,10 +3679,10 @@ gtk_combo_box_list_scroll_timeout (GtkComboBox *combo_box) return TRUE; } -static gboolean +static gboolean gtk_combo_box_list_enter_notify (GtkWidget *widget, - GdkEventCrossing *event, - gpointer data) + GdkEventCrossing *event, + gpointer data) { GtkComboBox *combo_box = GTK_COMBO_BOX (data); @@ -3696,10 +3693,10 @@ gtk_combo_box_list_enter_notify (GtkWidget *widget, static gboolean gtk_combo_box_list_select_func (GtkTreeSelection *selection, - GtkTreeModel *model, - GtkTreePath *path, - gboolean path_currently_selected, - gpointer data) + GtkTreeModel *model, + GtkTreePath *path, + gboolean path_currently_selected, + gpointer data) { GList *list, *columns; gboolean sensitive = FALSE; @@ -3714,25 +3711,25 @@ gtk_combo_box_list_select_func (GtkTreeSelection *selection, GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (list->data); if (!gtk_tree_view_column_get_visible (column)) - continue; + continue; gtk_tree_model_get_iter (model, &iter, path); gtk_tree_view_column_cell_set_cell_data (column, model, &iter, - FALSE, FALSE); + FALSE, FALSE); cell = cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); while (cell) { - g_object_get (cell->data, - "sensitive", &cell_sensitive, - "visible", &cell_visible, - NULL); + g_object_get (cell->data, + "sensitive", &cell_sensitive, + "visible", &cell_visible, + NULL); - if (cell_visible && cell_sensitive) - break; + if (cell_visible && cell_sensitive) + break; - cell = cell->next; - } + cell = cell->next; + } g_list_free (cells); sensitive = cell_sensitive; @@ -3807,10 +3804,10 @@ gtk_combo_box_new_with_area (GtkCellArea *area) GtkWidget * gtk_combo_box_new_with_area_and_entry (GtkCellArea *area) { - return g_object_new (GTK_TYPE_COMBO_BOX, - "has-entry", TRUE, - "cell-area", area, - NULL); + return g_object_new (GTK_TYPE_COMBO_BOX, + "has-entry", TRUE, + "cell-area", area, + NULL); } @@ -3871,8 +3868,8 @@ gtk_combo_box_new_with_model_and_entry (GtkTreeModel *model) * gtk_combo_box_get_wrap_width: * @combo_box: A #GtkComboBox * - * Returns the wrap width which is used to determine the number of columns - * for the popup menu. If the wrap width is larger than 1, the combo box + * Returns the wrap width which is used to determine the number of columns + * for the popup menu. If the wrap width is larger than 1, the combo box * is in table mode. * * Returns: the wrap width. @@ -3916,8 +3913,8 @@ gtk_combo_box_set_wrap_width (GtkComboBox *combo_box, gtk_combo_box_check_appearance (combo_box); if (GTK_IS_TREE_MENU (priv->popup_widget)) - _gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (priv->popup_widget), priv->wrap_width); - + _gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (priv->popup_widget), priv->wrap_width); + g_object_notify (G_OBJECT (combo_box), "wrap-width"); } } @@ -3970,7 +3967,7 @@ gtk_combo_box_set_row_span_column (GtkComboBox *combo_box, priv->row_column = row_span; if (GTK_IS_TREE_MENU (priv->popup_widget)) - _gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (priv->popup_widget), priv->row_column); + _gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (priv->popup_widget), priv->row_column); g_object_notify (G_OBJECT (combo_box), "row-span-column"); } @@ -4024,8 +4021,8 @@ gtk_combo_box_set_column_span_column (GtkComboBox *combo_box, priv->col_column = column_span; if (GTK_IS_TREE_MENU (priv->popup_widget)) - _gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (priv->popup_widget), priv->col_column); - + _gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (priv->popup_widget), priv->col_column); + g_object_notify (G_OBJECT (combo_box), "column-span-column"); } } @@ -4035,12 +4032,12 @@ gtk_combo_box_set_column_span_column (GtkComboBox *combo_box, * @combo_box: A #GtkComboBox * * Returns the index of the currently active item, or -1 if there's no - * active item. If the model is a non-flat treemodel, and the active item - * is not an immediate child of the root of the tree, this function returns - * gtk_tree_path_get_indices (path)[0], where + * active item. If the model is a non-flat treemodel, and the active item + * is not an immediate child of the root of the tree, this function returns + * gtk_tree_path_get_indices (path)[0], where * path is the #GtkTreePath of the active item. * - * Return value: An integer which is the index of the currently active item, + * Return value: An integer which is the index of the currently active item, * or -1 if there's no active item. * * Since: 2.4 @@ -4059,7 +4056,7 @@ gtk_combo_box_get_active (GtkComboBox *combo_box) { GtkTreePath *path; - path = gtk_tree_row_reference_get_path (priv->active_row); + path = gtk_tree_row_reference_get_path (priv->active_row); result = gtk_tree_path_get_indices (path)[0]; gtk_tree_path_free (path); } @@ -4097,7 +4094,7 @@ gtk_combo_box_set_active (GtkComboBox *combo_box, if (index_ != -1) path = gtk_tree_path_new_from_indices (index_, -1); - + gtk_combo_box_set_active_internal (combo_box, path); if (path) @@ -4106,7 +4103,7 @@ gtk_combo_box_set_active (GtkComboBox *combo_box, static void gtk_combo_box_set_active_internal (GtkComboBox *combo_box, - GtkTreePath *path) + GtkTreePath *path) { GtkComboBoxPrivate *priv = combo_box->priv; GtkTreePath *active_path; @@ -4121,7 +4118,7 @@ gtk_combo_box_set_active_internal (GtkComboBox *combo_box, path_cmp = gtk_tree_path_compare (path, active_path); gtk_tree_path_free (active_path); if (path_cmp == 0) - return; + return; } if (priv->active_row) @@ -4129,7 +4126,7 @@ gtk_combo_box_set_active_internal (GtkComboBox *combo_box, gtk_tree_row_reference_free (priv->active_row); priv->active_row = NULL; } - + if (!path) { if (priv->tree_view) @@ -4154,24 +4151,24 @@ gtk_combo_box_set_active_internal (GtkComboBox *combo_box, } else { - priv->active_row = - gtk_tree_row_reference_new (priv->model, path); + priv->active_row = + gtk_tree_row_reference_new (priv->model, path); if (priv->tree_view) - { - gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->tree_view), - path, NULL, FALSE); - } + { + gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->tree_view), + path, NULL, FALSE); + } else if (GTK_IS_MENU (priv->popup_widget)) { - /* FIXME handle nested menus better */ - gtk_menu_set_active (GTK_MENU (priv->popup_widget), - gtk_tree_path_get_indices (path)[0]); + /* FIXME handle nested menus better */ + gtk_menu_set_active (GTK_MENU (priv->popup_widget), + gtk_tree_path_get_indices (path)[0]); } if (priv->cell_view) - gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (priv->cell_view), - path); + gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (priv->cell_view), + path); } g_signal_emit (combo_box, combo_box_signals[CHANGED], 0); @@ -4185,9 +4182,9 @@ gtk_combo_box_set_active_internal (GtkComboBox *combo_box, * gtk_combo_box_get_active_iter: * @combo_box: A #GtkComboBox * @iter: (out): The uninitialized #GtkTreeIter - * + * * Sets @iter to point to the current active item, if it exists. - * + * * Return value: %TRUE, if @iter was set * * Since: 2.4 @@ -4215,10 +4212,10 @@ gtk_combo_box_get_active_iter (GtkComboBox *combo_box, * gtk_combo_box_set_active_iter: * @combo_box: A #GtkComboBox * @iter: (allow-none): The #GtkTreeIter, or %NULL - * + * * Sets the current active item to be the one referenced by @iter, or * unsets the active item if @iter is %NULL. - * + * * Since: 2.4 */ void @@ -4244,8 +4241,8 @@ gtk_combo_box_set_active_iter (GtkComboBox *combo_box, * Sets the model used by @combo_box to be @model. Will unset a previously set * model (if applicable). If model is %NULL, then it will unset the model. * - * Note that this function does not clear the cell renderers, you have to - * call gtk_cell_layout_clear() yourself if you need to set up different + * Note that this function does not clear the cell renderers, you have to + * call gtk_cell_layout_clear() yourself if you need to set up different * cell renderers for the new model. * * Since: 2.4 @@ -4259,7 +4256,7 @@ gtk_combo_box_set_model (GtkComboBox *combo_box, if (model == combo_box->priv->model) return; - + gtk_combo_box_unset_model (combo_box); if (model == NULL) @@ -4270,21 +4267,21 @@ gtk_combo_box_set_model (GtkComboBox *combo_box, combo_box->priv->inserted_id = g_signal_connect (combo_box->priv->model, "row-inserted", - G_CALLBACK (gtk_combo_box_model_row_inserted), - combo_box); + G_CALLBACK (gtk_combo_box_model_row_inserted), + combo_box); combo_box->priv->deleted_id = g_signal_connect (combo_box->priv->model, "row-deleted", - G_CALLBACK (gtk_combo_box_model_row_deleted), - combo_box); + G_CALLBACK (gtk_combo_box_model_row_deleted), + combo_box); combo_box->priv->reordered_id = g_signal_connect (combo_box->priv->model, "rows-reordered", - G_CALLBACK (gtk_combo_box_model_rows_reordered), - combo_box); + G_CALLBACK (gtk_combo_box_model_rows_reordered), + combo_box); combo_box->priv->changed_id = g_signal_connect (combo_box->priv->model, "row-changed", - G_CALLBACK (gtk_combo_box_model_row_changed), - combo_box); - + G_CALLBACK (gtk_combo_box_model_row_changed), + combo_box); + if (combo_box->priv->tree_view) { /* list mode */ @@ -4296,8 +4293,8 @@ gtk_combo_box_set_model (GtkComboBox *combo_box, if (GTK_IS_TREE_MENU (combo_box->priv->popup_widget)) { /* menu mode */ - _gtk_tree_menu_set_model (GTK_TREE_MENU (combo_box->priv->popup_widget), - combo_box->priv->model); + _gtk_tree_menu_set_model (GTK_TREE_MENU (combo_box->priv->popup_widget), + combo_box->priv->model); } if (combo_box->priv->cell_view) @@ -4360,9 +4357,9 @@ gtk_combo_box_real_move_active (GtkComboBox *combo_box, case GTK_SCROLL_STEP_LEFT: if (active_iter) { - found = tree_prev (combo_box, combo_box->priv->model, - &iter, &new_iter, FALSE); - break; + found = tree_prev (combo_box, combo_box->priv->model, + &iter, &new_iter, FALSE); + break; } /* else fall through */ @@ -4378,8 +4375,8 @@ gtk_combo_box_real_move_active (GtkComboBox *combo_box, case GTK_SCROLL_STEP_RIGHT: if (active_iter) { - found = tree_next (combo_box, combo_box->priv->model, - &iter, &new_iter, FALSE); + found = tree_next (combo_box, combo_box->priv->model, + &iter, &new_iter, FALSE); break; } /* else fall through */ @@ -4422,7 +4419,7 @@ gtk_combo_box_real_move_active (GtkComboBox *combo_box, static gboolean gtk_combo_box_mnemonic_activate (GtkWidget *widget, - gboolean group_cycling) + gboolean group_cycling) { GtkComboBox *combo_box = GTK_COMBO_BOX (widget); @@ -4432,7 +4429,7 @@ gtk_combo_box_mnemonic_activate (GtkWidget *widget, child = gtk_bin_get_child (GTK_BIN (combo_box)); if (child) - gtk_widget_grab_focus (child); + gtk_widget_grab_focus (child); } else gtk_widget_grab_focus (combo_box->priv->button); @@ -4451,7 +4448,7 @@ gtk_combo_box_grab_focus (GtkWidget *widget) child = gtk_bin_get_child (GTK_BIN (combo_box)); if (child) - gtk_widget_grab_focus (child); + gtk_widget_grab_focus (child); } else gtk_widget_grab_focus (combo_box->priv->button); @@ -4511,31 +4508,31 @@ gtk_combo_box_entry_active_changed (GtkComboBox *combo_box, GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo_box))); if (entry) - { + { GValue value = {0,}; - g_signal_handlers_block_by_func (entry, - gtk_combo_box_entry_contents_changed, - combo_box); + g_signal_handlers_block_by_func (entry, + gtk_combo_box_entry_contents_changed, + combo_box); - model = gtk_combo_box_get_model (combo_box); + model = gtk_combo_box_get_model (combo_box); gtk_tree_model_get_value (model, &iter, priv->text_column, &value); g_object_set_property (G_OBJECT (entry), "text", &value); g_value_unset (&value); - g_signal_handlers_unblock_by_func (entry, - gtk_combo_box_entry_contents_changed, - combo_box); - } + g_signal_handlers_unblock_by_func (entry, + gtk_combo_box_entry_contents_changed, + combo_box); + } } } static GObject * gtk_combo_box_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) + guint n_construct_properties, + GObjectConstructParam *construct_properties) { GObject *object; GtkComboBox *combo_box; @@ -4577,12 +4574,12 @@ gtk_combo_box_constructor (GType type, priv->text_renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), - priv->text_renderer, TRUE); + priv->text_renderer, TRUE); gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), -1); g_signal_connect (combo_box, "changed", - G_CALLBACK (gtk_combo_box_entry_active_changed), NULL); + G_CALLBACK (gtk_combo_box_entry_active_changed), NULL); } return object; @@ -4633,8 +4630,8 @@ gtk_combo_box_finalize (GObject *object) static gboolean gtk_cell_editable_key_press (GtkWidget *widget, - GdkEventKey *event, - gpointer data) + GdkEventKey *event, + gpointer data) { GtkComboBox *combo_box = GTK_COMBO_BOX (data); @@ -4645,7 +4642,7 @@ gtk_cell_editable_key_press (GtkWidget *widget, NULL); gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box)); gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (combo_box)); - + return TRUE; } else if (event->keyval == GDK_KEY_Return || @@ -4654,7 +4651,7 @@ gtk_cell_editable_key_press (GtkWidget *widget, { gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box)); gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (combo_box)); - + return TRUE; } @@ -4667,7 +4664,7 @@ popdown_idle (gpointer data) GtkComboBox *combo_box; combo_box = GTK_COMBO_BOX (data); - + gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box)); gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (combo_box)); @@ -4678,7 +4675,7 @@ popdown_idle (gpointer data) static void popdown_handler (GtkWidget *widget, - gpointer data) + gpointer data) { gdk_threads_add_idle (popdown_idle, g_object_ref (data)); } @@ -4693,9 +4690,9 @@ popup_idle (gpointer data) if (GTK_IS_MENU (combo_box->priv->popup_widget) && combo_box->priv->cell_view) g_signal_connect_object (combo_box->priv->popup_widget, - "unmap", G_CALLBACK (popdown_handler), - combo_box, 0); - + "unmap", G_CALLBACK (popdown_handler), + combo_box, 0); + /* we unset this if a menu item is activated */ g_object_set (combo_box, "editing-canceled", TRUE, @@ -4711,7 +4708,7 @@ popup_idle (gpointer data) static void gtk_combo_box_start_editing (GtkCellEditable *cell_editable, - GdkEvent *event) + GdkEvent *event) { GtkComboBox *combo_box = GTK_COMBO_BOX (cell_editable); GtkWidget *child; @@ -4721,8 +4718,8 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable, if (combo_box->priv->cell_view) { g_signal_connect_object (combo_box->priv->button, "key-press-event", - G_CALLBACK (gtk_cell_editable_key_press), - cell_editable, 0); + G_CALLBACK (gtk_cell_editable_key_press), + cell_editable, 0); gtk_widget_grab_focus (combo_box->priv->button); } @@ -4731,17 +4728,17 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable, child = gtk_bin_get_child (GTK_BIN (combo_box)); g_signal_connect_object (child, "key-press-event", - G_CALLBACK (gtk_cell_editable_key_press), - cell_editable, 0); + G_CALLBACK (gtk_cell_editable_key_press), + cell_editable, 0); gtk_widget_grab_focus (child); gtk_widget_set_can_focus (combo_box->priv->button, FALSE); } - /* we do the immediate popup only for the optionmenu-like - * appearance - */ - if (combo_box->priv->is_cell_renderer && + /* we do the immediate popup only for the optionmenu-like + * appearance + */ + if (combo_box->priv->is_cell_renderer && combo_box->priv->cell_view && !combo_box->priv->tree_view) { if (event && event->type == GDK_BUTTON_PRESS) @@ -4752,7 +4749,7 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable, combo_box->priv->activate_time = event_button->time; } - combo_box->priv->popup_idle_id = + combo_box->priv->popup_idle_id = gdk_threads_add_idle (popup_idle, combo_box); } } @@ -4761,9 +4758,9 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable, /** * gtk_combo_box_get_add_tearoffs: * @combo_box: a #GtkComboBox - * + * * Gets the current value of the :add-tearoffs property. - * + * * Return value: the current value of the :add-tearoffs property. */ gboolean @@ -4776,17 +4773,17 @@ gtk_combo_box_get_add_tearoffs (GtkComboBox *combo_box) /** * gtk_combo_box_set_add_tearoffs: - * @combo_box: a #GtkComboBox + * @combo_box: a #GtkComboBox * @add_tearoffs: %TRUE to add tearoff menu items - * - * Sets whether the popup menu should have a tearoff + * + * Sets whether the popup menu should have a tearoff * menu item. * * Since: 2.6 */ void gtk_combo_box_set_add_tearoffs (GtkComboBox *combo_box, - gboolean add_tearoffs) + gboolean add_tearoffs) { g_return_if_fail (GTK_IS_COMBO_BOX (combo_box)); @@ -4798,8 +4795,8 @@ gtk_combo_box_set_add_tearoffs (GtkComboBox *combo_box, gtk_combo_box_check_appearance (combo_box); if (GTK_IS_TREE_MENU (combo_box->priv->popup_widget)) - _gtk_tree_menu_set_tearoff (GTK_TREE_MENU (combo_box->priv->popup_widget), - combo_box->priv->add_tearoffs); + _gtk_tree_menu_set_tearoff (GTK_TREE_MENU (combo_box->priv->popup_widget), + combo_box->priv->add_tearoffs); g_object_notify (G_OBJECT (combo_box), "add-tearoffs"); } @@ -4821,7 +4818,7 @@ G_CONST_RETURN gchar* gtk_combo_box_get_title (GtkComboBox *combo_box) { g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), NULL); - + return combo_box->priv->tearoff_title; } @@ -4829,25 +4826,25 @@ static void gtk_combo_box_update_title (GtkComboBox *combo_box) { gtk_combo_box_check_appearance (combo_box); - - if (combo_box->priv->popup_widget && + + if (combo_box->priv->popup_widget && GTK_IS_MENU (combo_box->priv->popup_widget)) - gtk_menu_set_title (GTK_MENU (combo_box->priv->popup_widget), - combo_box->priv->tearoff_title); + gtk_menu_set_title (GTK_MENU (combo_box->priv->popup_widget), + combo_box->priv->tearoff_title); } /** * gtk_combo_box_set_title: - * @combo_box: a #GtkComboBox + * @combo_box: a #GtkComboBox * @title: a title for the menu in tearoff mode - * + * * Sets the menu's title in tearoff mode. * * Since: 2.10 */ void gtk_combo_box_set_title (GtkComboBox *combo_box, - const gchar *title) + const gchar *title) { GtkComboBoxPrivate *priv; @@ -4855,8 +4852,8 @@ gtk_combo_box_set_title (GtkComboBox *combo_box, priv = combo_box->priv; - if (strcmp (title ? title : "", - priv->tearoff_title ? priv->tearoff_title : "") != 0) + if (strcmp (title ? title : "", + priv->tearoff_title ? priv->tearoff_title : "") != 0) { g_free (priv->tearoff_title); priv->tearoff_title = g_strdup (title); @@ -4945,14 +4942,14 @@ gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box) /** * gtk_combo_box_get_row_separator_func: * @combo_box: a #GtkComboBox - * + * * Returns the current row separator function. - * + * * Return value: the current row separator function. * * Since: 2.6 */ -GtkTreeViewRowSeparatorFunc +GtkTreeViewRowSeparatorFunc gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box) { g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), NULL); @@ -4966,7 +4963,7 @@ gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box) * @func: a #GtkTreeViewRowSeparatorFunc * @data: (allow-none): user data to pass to @func, or %NULL * @destroy: (allow-none): destroy notifier for @data, or %NULL - * + * * Sets the row separator function, which is used to determine * whether a row should be drawn as a separator. If the row separator * function is %NULL, no separators are drawn. This is the default value. @@ -4975,9 +4972,9 @@ gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box) */ void gtk_combo_box_set_row_separator_func (GtkComboBox *combo_box, - GtkTreeViewRowSeparatorFunc func, - gpointer data, - GDestroyNotify destroy) + GtkTreeViewRowSeparatorFunc func, + gpointer data, + GDestroyNotify destroy) { g_return_if_fail (GTK_IS_COMBO_BOX (combo_box)); @@ -5089,7 +5086,7 @@ gtk_combo_box_get_has_entry (GtkComboBox *combo_box) */ void gtk_combo_box_set_entry_text_column (GtkComboBox *combo_box, - gint text_column) + gint text_column) { GtkComboBoxPrivate *priv = combo_box->priv; GtkTreeModel *model; @@ -5132,22 +5129,22 @@ gtk_combo_box_get_entry_text_column (GtkComboBox *combo_box) /** * gtk_combo_box_set_focus_on_click: * @combo: a #GtkComboBox - * @focus_on_click: whether the combo box grabs focus when clicked + * @focus_on_click: whether the combo box grabs focus when clicked * with the mouse - * - * Sets whether the combo box will grab focus when it is clicked with - * the mouse. Making mouse clicks not grab focus is useful in places - * like toolbars where you don't want the keyboard focus removed from + * + * Sets whether the combo box will grab focus when it is clicked with + * the mouse. Making mouse clicks not grab focus is useful in places + * like toolbars where you don't want the keyboard focus removed from * the main area of the application. * * Since: 2.6 */ void gtk_combo_box_set_focus_on_click (GtkComboBox *combo_box, - gboolean focus_on_click) + gboolean focus_on_click) { g_return_if_fail (GTK_IS_COMBO_BOX (combo_box)); - + focus_on_click = focus_on_click != FALSE; if (combo_box->priv->focus_on_click != focus_on_click) @@ -5155,9 +5152,9 @@ gtk_combo_box_set_focus_on_click (GtkComboBox *combo_box, combo_box->priv->focus_on_click = focus_on_click; if (combo_box->priv->button) - gtk_button_set_focus_on_click (GTK_BUTTON (combo_box->priv->button), - focus_on_click); - + gtk_button_set_focus_on_click (GTK_BUTTON (combo_box->priv->button), + focus_on_click); + g_object_notify (G_OBJECT (combo_box), "focus-on-click"); } } @@ -5165,11 +5162,11 @@ gtk_combo_box_set_focus_on_click (GtkComboBox *combo_box, /** * gtk_combo_box_get_focus_on_click: * @combo: a #GtkComboBox - * - * Returns whether the combo box grabs focus when it is clicked + * + * Returns whether the combo box grabs focus when it is clicked * with the mouse. See gtk_combo_box_set_focus_on_click(). * - * Return value: %TRUE if the combo box grabs focus when it is + * Return value: %TRUE if the combo box grabs focus when it is * clicked with the mouse. * * Since: 2.6 @@ -5185,26 +5182,26 @@ gtk_combo_box_get_focus_on_click (GtkComboBox *combo_box) static gboolean gtk_combo_box_buildable_custom_tag_start (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - GMarkupParser *parser, - gpointer *data) + GtkBuilder *builder, + GObject *child, + const gchar *tagname, + GMarkupParser *parser, + gpointer *data) { if (parent_buildable_iface->custom_tag_start (buildable, builder, child, - tagname, parser, data)) + tagname, parser, data)) return TRUE; return _gtk_cell_layout_buildable_custom_tag_start (buildable, builder, child, - tagname, parser, data); + tagname, parser, data); } static void gtk_combo_box_buildable_custom_tag_end (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - gpointer *data) + GtkBuilder *builder, + GObject *child, + const gchar *tagname, + gpointer *data) { if (!_gtk_cell_layout_buildable_custom_tag_end (buildable, builder, child, tagname, data)) parent_buildable_iface->custom_tag_end (buildable, builder, child, tagname, data); @@ -5212,8 +5209,8 @@ gtk_combo_box_buildable_custom_tag_end (GtkBuildable *buildable, static GObject * gtk_combo_box_buildable_get_internal_child (GtkBuildable *buildable, - GtkBuilder *builder, - const gchar *childname) + GtkBuilder *builder, + const gchar *childname) { GtkComboBox *combo_box = GTK_COMBO_BOX (buildable); @@ -5223,7 +5220,7 @@ gtk_combo_box_buildable_get_internal_child (GtkBuildable *buildable, return parent_buildable_iface->get_internal_child (buildable, builder, childname); } -static void +static void gtk_combo_box_get_preferred_width (GtkWidget *widget, gint *minimum_size, gint *natural_size) @@ -5243,29 +5240,29 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget, GtkBorder *border; child = gtk_bin_get_child (GTK_BIN (widget)); - + /* common */ gtk_widget_get_preferred_width (child, &child_min, &child_nat); gtk_widget_style_get (GTK_WIDGET (widget), - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - "arrow-size", &arrow_size, - NULL); + "focus-line-width", &focus_width, + "focus-padding", &focus_pad, + "arrow-size", &arrow_size, + NULL); style_context = gtk_widget_get_style_context (widget); state = gtk_widget_get_state_flags (widget); gtk_style_context_get (style_context, state, "font", &font_desc, - "border-width", &border, + "border-width", &border, NULL); context = gtk_widget_get_pango_context (GTK_WIDGET (widget)); metrics = pango_context_get_metrics (context, font_desc, - pango_context_get_language (context)); + pango_context_get_language (context)); font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + - pango_font_metrics_get_descent (metrics)); + pango_font_metrics_get_descent (metrics)); pango_font_metrics_unref (metrics); pango_font_description_free (font_desc); @@ -5275,20 +5272,20 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget, if (!priv->tree_view) { - /* menu mode */ + /* menu mode */ if (priv->cell_view) { gint sep_width, arrow_width; gint border_width, xpad; - GtkBorder button_border; + GtkBorder button_border; - border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box)); - get_widget_border (priv->button, &button_border); + border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box)); + get_widget_border (priv->button, &button_border); gtk_widget_get_preferred_width (priv->separator, &sep_width, NULL); gtk_widget_get_preferred_width (priv->arrow, &arrow_width, NULL); - xpad = 2 * (border_width + focus_width + focus_pad) + + xpad = 2 * (border_width + focus_width + focus_pad) + button_border.left + button_border.right; minimum_width = child_min + sep_width + arrow_width + xpad; @@ -5298,7 +5295,7 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget, { gint but_width, but_nat_width; - gtk_widget_get_preferred_width (priv->button, + gtk_widget_get_preferred_width (priv->button, &but_width, &but_nat_width); minimum_width = child_min + but_width; @@ -5316,25 +5313,25 @@ gtk_combo_box_get_preferred_width (GtkWidget *widget, minimum_width += 2 * focus_width; natural_width += 2 * focus_width; - + if (priv->cell_view_frame) { - if (priv->has_frame) - { - gint border_width, xpad; + if (priv->has_frame) + { + gint border_width, xpad; GtkBorder frame_border; border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame)); get_widget_border (priv->cell_view_frame, &frame_border); xpad = (2 * border_width) + frame_border.left + frame_border.right; - minimum_width += xpad; - natural_width += xpad; - } + minimum_width += xpad; + natural_width += xpad; + } } /* the button */ - gtk_widget_get_preferred_width (priv->button, + gtk_widget_get_preferred_width (priv->button, &button_width, &button_nat_width); minimum_width += button_width; @@ -5356,10 +5353,10 @@ static void gtk_combo_box_get_preferred_height (GtkWidget *widget, gint *minimum_size, gint *natural_size) -{ +{ gint min_width; - /* Combo box is height-for-width only + /* Combo box is height-for-width only * (so we always just reserve enough height for the minimum width) */ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, &min_width, NULL); GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width (widget, min_width, minimum_size, natural_size); @@ -5371,7 +5368,7 @@ gtk_combo_box_get_preferred_width_for_height (GtkWidget *widget, gint *minimum_size, gint *natural_size) { - /* Combo box is height-for-width only + /* Combo box is height-for-width only * (so we assume we always reserved enough height for the minimum width) */ GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, minimum_size, natural_size); } @@ -5392,9 +5389,9 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget, GtkBorder border; gtk_widget_style_get (GTK_WIDGET (widget), - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); + "focus-line-width", &focus_width, + "focus-padding", &focus_pad, + NULL); child = gtk_bin_get_child (GTK_BIN (widget)); @@ -5406,56 +5403,56 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget, /* menu mode */ if (priv->cell_view) { - /* calculate x/y padding and separator/arrow size */ + /* calculate x/y padding and separator/arrow size */ gint sep_width, arrow_width, sep_height, arrow_height; gint border_width, xpad, ypad; GtkBorder button_border; - border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box)); - get_widget_border (priv->button, &button_border); + border_width = gtk_container_get_border_width (GTK_CONTAINER (combo_box)); + get_widget_border (priv->button, &button_border); gtk_widget_get_preferred_width (priv->separator, &sep_width, NULL); gtk_widget_get_preferred_width (priv->arrow, &arrow_width, NULL); - gtk_widget_get_preferred_height_for_width (priv->separator, + gtk_widget_get_preferred_height_for_width (priv->separator, sep_width, &sep_height, NULL); - gtk_widget_get_preferred_height_for_width (priv->arrow, + gtk_widget_get_preferred_height_for_width (priv->arrow, arrow_width, &arrow_height, NULL); - xpad = 2 * (border_width + focus_width + focus_pad) + - button_border.left + button_border.right; - ypad = 2 * (border_width + focus_width + focus_pad) + - button_border.top + button_border.bottom; + xpad = 2 * (border_width + focus_width + focus_pad) + + button_border.left + button_border.right; + ypad = 2 * (border_width + focus_width + focus_pad) + + button_border.top + button_border.bottom; - size -= sep_width + arrow_width + xpad; + size -= sep_width + arrow_width + xpad; - /* Get height-for-width of the child widget, usually a GtkCellArea calculating - * and fitting the whole treemodel */ - gtk_widget_get_preferred_height_for_width (child, size, &min_height, &nat_height); + /* Get height-for-width of the child widget, usually a GtkCellArea calculating + * and fitting the whole treemodel */ + gtk_widget_get_preferred_height_for_width (child, size, &min_height, &nat_height); - arrow_height = MAX (arrow_height, sep_height); - min_height = MAX (min_height, arrow_height); - nat_height = MAX (nat_height, arrow_height); + arrow_height = MAX (arrow_height, sep_height); + min_height = MAX (min_height, arrow_height); + nat_height = MAX (nat_height, arrow_height); - min_height += ypad; - nat_height += ypad; + min_height += ypad; + nat_height += ypad; } else { - /* there is a custom child widget inside (no priv->cell_view) */ + /* there is a custom child widget inside (no priv->cell_view) */ gint but_width, but_height; gtk_widget_get_preferred_width (priv->button, &but_width, NULL); - gtk_widget_get_preferred_height_for_width (priv->button, + gtk_widget_get_preferred_height_for_width (priv->button, but_width, &but_height, NULL); - size -= but_width; + size -= but_width; + + /* Get height-for-width of the child widget, usually a GtkCellArea calculating + * and fitting the whole treemodel */ + gtk_widget_get_preferred_height_for_width (child, size, &min_height, &nat_height); - /* Get height-for-width of the child widget, usually a GtkCellArea calculating - * and fitting the whole treemodel */ - gtk_widget_get_preferred_height_for_width (child, size, &min_height, &nat_height); - - min_height = MAX (min_height, but_height); - nat_height = MAX (nat_height, but_height); + min_height = MAX (min_height, but_height); + nat_height = MAX (nat_height, but_height); } } else @@ -5465,25 +5462,25 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget, gint xpad = 0, ypad = 0; gtk_widget_get_preferred_width (priv->button, &but_width, NULL); - gtk_widget_get_preferred_height_for_width (priv->button, + gtk_widget_get_preferred_height_for_width (priv->button, but_width, &but_height, NULL); - + if (priv->cell_view_frame && priv->has_frame) - { - GtkBorder frame_border; - gint border_width; + { + GtkBorder frame_border; + gint border_width; border_width = gtk_container_get_border_width (GTK_CONTAINER (priv->cell_view_frame)); - get_widget_border (GTK_WIDGET (priv->cell_view_frame), &frame_border); + get_widget_border (GTK_WIDGET (priv->cell_view_frame), &frame_border); - xpad = (2 * border_width) + border.left + frame_border.right; - ypad = (2 * border_width) + border.top + frame_border.bottom; - } + xpad = (2 * border_width) + border.left + frame_border.right; + ypad = (2 * border_width) + border.top + frame_border.bottom; + } size -= but_width; size -= 2 * focus_width; size -= xpad; - + /* Get height-for-width of the child widget, usually a GtkCellArea calculating * and fitting the whole treemodel */ gtk_widget_get_preferred_height_for_width (child, size, &min_height, &nat_height); diff --git a/gtk/gtkcombobox.h b/gtk/gtkcombobox.h index 30a9769403..124a9bfb61 100644 --- a/gtk/gtkcombobox.h +++ b/gtk/gtkcombobox.h @@ -86,15 +86,15 @@ void gtk_combo_box_set_column_span_column (GtkComboBox *combo_box, gboolean gtk_combo_box_get_add_tearoffs (GtkComboBox *combo_box); void gtk_combo_box_set_add_tearoffs (GtkComboBox *combo_box, - gboolean add_tearoffs); + gboolean add_tearoffs); G_CONST_RETURN gchar *gtk_combo_box_get_title (GtkComboBox *combo_box); void gtk_combo_box_set_title (GtkComboBox *combo_box, - const gchar *title); + const gchar *title); gboolean gtk_combo_box_get_focus_on_click (GtkComboBox *combo); void gtk_combo_box_set_focus_on_click (GtkComboBox *combo, - gboolean focus_on_click); + gboolean focus_on_click); /* get/set active item */ gint gtk_combo_box_get_active (GtkComboBox *combo_box); @@ -112,21 +112,21 @@ GtkTreeModel *gtk_combo_box_get_model (GtkComboBox *combo_box); GtkTreeViewRowSeparatorFunc gtk_combo_box_get_row_separator_func (GtkComboBox *combo_box); void gtk_combo_box_set_row_separator_func (GtkComboBox *combo_box, - GtkTreeViewRowSeparatorFunc func, - gpointer data, - GDestroyNotify destroy); + GtkTreeViewRowSeparatorFunc func, + gpointer data, + GDestroyNotify destroy); void gtk_combo_box_set_button_sensitivity (GtkComboBox *combo_box, - GtkSensitivityType sensitivity); + GtkSensitivityType sensitivity); GtkSensitivityType gtk_combo_box_get_button_sensitivity (GtkComboBox *combo_box); gboolean gtk_combo_box_get_has_entry (GtkComboBox *combo_box); void gtk_combo_box_set_entry_text_column (GtkComboBox *combo_box, - gint text_column); + gint text_column); gint gtk_combo_box_get_entry_text_column (GtkComboBox *combo_box); void gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box, - gboolean fixed); + gboolean fixed); gboolean gtk_combo_box_get_popup_fixed_width (GtkComboBox *combo_box); /* programmatic control */ diff --git a/gtk/gtktreemenu.c b/gtk/gtktreemenu.c index bd7e1fdf02..9340ee68d9 100644 --- a/gtk/gtktreemenu.c +++ b/gtk/gtktreemenu.c @@ -28,7 +28,7 @@ * @Short_Description: A GtkMenu automatically created from a #GtkTreeModel * @Title: GtkTreeMenu * - * The #GtkTreeMenu is used to display a drop-down menu allowing selection + * The #GtkTreeMenu is used to display a drop-down menu allowing selection * of every row in the model and is used by the #GtkComboBox for its drop-down * menu. */ @@ -50,26 +50,26 @@ /* GObjectClass */ static GObject *gtk_tree_menu_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties); + guint n_construct_properties, + GObjectConstructParam *construct_properties); static void gtk_tree_menu_dispose (GObject *object); static void gtk_tree_menu_finalize (GObject *object); static void gtk_tree_menu_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); + guint prop_id, + const GValue *value, + GParamSpec *pspec); static void gtk_tree_menu_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); + guint prop_id, + GValue *value, + GParamSpec *pspec); /* GtkWidgetClass */ static void gtk_tree_menu_get_preferred_width (GtkWidget *widget, - gint *minimum_size, - gint *natural_size); + gint *minimum_size, + gint *natural_size); static void gtk_tree_menu_get_preferred_height (GtkWidget *widget, - gint *minimum_size, - gint *natural_size); + gint *minimum_size, + gint *natural_size); /* GtkCellLayoutIface */ static void gtk_tree_menu_cell_layout_init (GtkCellLayoutIface *iface); @@ -79,60 +79,60 @@ static GtkCellArea *gtk_tree_menu_cell_layout_get_area (GtkCellLayout /* TreeModel/DrawingArea callbacks and building menus/submenus */ static inline void rebuild_menu (GtkTreeMenu *menu); static gboolean menu_occupied (GtkTreeMenu *menu, - guint left_attach, - guint right_attach, - guint top_attach, - guint bottom_attach); + guint left_attach, + guint right_attach, + guint top_attach, + guint bottom_attach); static void relayout_item (GtkTreeMenu *menu, - GtkWidget *item, - GtkTreeIter *iter, - GtkWidget *prev); + GtkWidget *item, + GtkTreeIter *iter, + GtkWidget *prev); static void gtk_tree_menu_populate (GtkTreeMenu *menu); static GtkWidget *gtk_tree_menu_create_item (GtkTreeMenu *menu, - GtkTreeIter *iter, - gboolean header_item); + GtkTreeIter *iter, + gboolean header_item); static void gtk_tree_menu_create_submenu (GtkTreeMenu *menu, - GtkWidget *item, - GtkTreePath *path); + GtkWidget *item, + GtkTreePath *path); static void gtk_tree_menu_set_area (GtkTreeMenu *menu, - GtkCellArea *area); + GtkCellArea *area); static GtkWidget *gtk_tree_menu_get_path_item (GtkTreeMenu *menu, - GtkTreePath *path); + GtkTreePath *path); static gboolean gtk_tree_menu_path_in_menu (GtkTreeMenu *menu, - GtkTreePath *path, - gboolean *header_item); + GtkTreePath *path, + gboolean *header_item); static void row_inserted_cb (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - GtkTreeMenu *menu); + GtkTreePath *path, + GtkTreeIter *iter, + GtkTreeMenu *menu); static void row_deleted_cb (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeMenu *menu); + GtkTreePath *path, + GtkTreeMenu *menu); static void row_reordered_cb (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gint *new_order, - GtkTreeMenu *menu); + GtkTreePath *path, + GtkTreeIter *iter, + gint *new_order, + GtkTreeMenu *menu); static void row_changed_cb (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - GtkTreeMenu *menu); + GtkTreePath *path, + GtkTreeIter *iter, + GtkTreeMenu *menu); static void context_size_changed_cb (GtkCellAreaContext *context, - GParamSpec *pspec, - GtkWidget *menu); + GParamSpec *pspec, + GtkWidget *menu); static void area_apply_attributes_cb (GtkCellArea *area, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gboolean is_expander, - gboolean is_expanded, - GtkTreeMenu *menu); + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gboolean is_expander, + gboolean is_expanded, + GtkTreeMenu *menu); static void item_activated_cb (GtkMenuItem *item, - GtkTreeMenu *menu); + GtkTreeMenu *menu); static void submenu_activated_cb (GtkTreeMenu *submenu, - const gchar *path, - GtkTreeMenu *menu); + const gchar *path, + GtkTreeMenu *menu); static void gtk_tree_menu_set_model_internal (GtkTreeMenu *menu, - GtkTreeModel *model); + GtkTreeModel *model); @@ -145,7 +145,7 @@ struct _GtkTreeMenuPrivate /* CellArea and context for this menu */ GtkCellArea *area; GtkCellAreaContext *context; - + /* Signals */ gulong size_changed_id; gulong apply_attributes_id; @@ -194,8 +194,8 @@ static guint tree_menu_signals[N_SIGNALS] = { 0 }; static GQuark tree_menu_path_quark = 0; G_DEFINE_TYPE_WITH_CODE (GtkTreeMenu, _gtk_tree_menu, GTK_TYPE_MENU, - G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, - gtk_tree_menu_cell_layout_init)); + G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, + gtk_tree_menu_cell_layout_init)); static void _gtk_tree_menu_init (GtkTreeMenu *menu) @@ -203,8 +203,8 @@ _gtk_tree_menu_init (GtkTreeMenu *menu) GtkTreeMenuPrivate *priv; menu->priv = G_TYPE_INSTANCE_GET_PRIVATE (menu, - GTK_TYPE_TREE_MENU, - GtkTreeMenuPrivate); + GTK_TYPE_TREE_MENU, + GtkTreeMenuPrivate); priv = menu->priv; priv->model = NULL; @@ -236,7 +236,7 @@ _gtk_tree_menu_init (GtkTreeMenu *menu) gtk_menu_set_reserve_toggle_size (GTK_MENU (menu), FALSE); } -static void +static void _gtk_tree_menu_class_init (GtkTreeMenuClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); @@ -267,12 +267,12 @@ _gtk_tree_menu_class_init (GtkTreeMenuClass *class) */ tree_menu_signals[SIGNAL_MENU_ACTIVATE] = g_signal_new (I_("menu-activate"), - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, /* No class closure here */ - NULL, NULL, - _gtk_marshal_VOID__STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, /* No class closure here */ + NULL, NULL, + _gtk_marshal_VOID__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING); /** * GtkTreeMenu:model: @@ -307,11 +307,11 @@ _gtk_tree_menu_class_init (GtkTreeMenuClass *class) g_object_class_install_property (object_class, PROP_ROOT, g_param_spec_boxed ("root", - P_("TreeMenu root row"), - P_("The TreeMenu will display children of the " - "specified root"), - GTK_TYPE_TREE_PATH, - GTK_PARAM_READWRITE)); + P_("TreeMenu root row"), + P_("The TreeMenu will display children of the " + "specified root"), + GTK_TYPE_TREE_PATH, + GTK_PARAM_READWRITE)); /** * GtkTreeMenu:cell-area: @@ -324,12 +324,12 @@ _gtk_tree_menu_class_init (GtkTreeMenuClass *class) * Since: 3.0 */ g_object_class_install_property (object_class, - PROP_CELL_AREA, - g_param_spec_object ("cell-area", - P_("Cell Area"), - P_("The GtkCellArea used to layout cells"), - GTK_TYPE_CELL_AREA, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + PROP_CELL_AREA, + g_param_spec_object ("cell-area", + P_("Cell Area"), + P_("The GtkCellArea used to layout cells"), + GTK_TYPE_CELL_AREA, + GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** * GtkTreeMenu:tearoff: @@ -339,12 +339,12 @@ _gtk_tree_menu_class_init (GtkTreeMenuClass *class) * Since: 3.0 */ g_object_class_install_property (object_class, - PROP_TEAROFF, - g_param_spec_boolean ("tearoff", - P_("Tearoff"), - P_("Whether the menu has a tearoff item"), - FALSE, - GTK_PARAM_READWRITE)); + PROP_TEAROFF, + g_param_spec_boolean ("tearoff", + P_("Tearoff"), + P_("Whether the menu has a tearoff item"), + FALSE, + GTK_PARAM_READWRITE)); /** * GtkTreeMenu:wrap-width: @@ -356,57 +356,57 @@ _gtk_tree_menu_class_init (GtkTreeMenuClass *class) * Since: 3.0 */ g_object_class_install_property (object_class, - PROP_WRAP_WIDTH, - g_param_spec_int ("wrap-width", - P_("Wrap Width"), - P_("Wrap width for laying out items in a grid"), - 0, - G_MAXINT, - 0, - GTK_PARAM_READWRITE)); + PROP_WRAP_WIDTH, + g_param_spec_int ("wrap-width", + P_("Wrap Width"), + P_("Wrap width for laying out items in a grid"), + 0, + G_MAXINT, + 0, + GTK_PARAM_READWRITE)); /** * GtkTreeMenu:row-span-column: * - * If this is set to a non-negative value, it must be the index of a column - * of type %G_TYPE_INT in the model. + * If this is set to a non-negative value, it must be the index of a column + * of type %G_TYPE_INT in the model. * - * The values of that column are used to determine how many rows a value in - * the list will span. Therefore, the values in the model column pointed to + * The values of that column are used to determine how many rows a value in + * the list will span. Therefore, the values in the model column pointed to * by this property must be greater than zero and not larger than wrap-width. * * Since: 3.0 */ g_object_class_install_property (object_class, - PROP_ROW_SPAN_COL, - g_param_spec_int ("row-span-column", - P_("Row span column"), - P_("TreeModel column containing the row span values"), - -1, - G_MAXINT, - -1, - GTK_PARAM_READWRITE)); + PROP_ROW_SPAN_COL, + g_param_spec_int ("row-span-column", + P_("Row span column"), + P_("TreeModel column containing the row span values"), + -1, + G_MAXINT, + -1, + GTK_PARAM_READWRITE)); /** * GtkTreeMenu:column-span-column: * - * If this is set to a non-negative value, it must be the index of a column - * of type %G_TYPE_INT in the model. + * If this is set to a non-negative value, it must be the index of a column + * of type %G_TYPE_INT in the model. * - * The values of that column are used to determine how many columns a value - * in the list will span. + * The values of that column are used to determine how many columns a value + * in the list will span. * * Since: 3.0 */ g_object_class_install_property (object_class, - PROP_COL_SPAN_COL, - g_param_spec_int ("column-span-column", - P_("Column span column"), - P_("TreeModel column containing the column span values"), - -1, - G_MAXINT, - -1, - GTK_PARAM_READWRITE)); + PROP_COL_SPAN_COL, + g_param_spec_int ("column-span-column", + P_("Column span column"), + P_("TreeModel column containing the column span values"), + -1, + G_MAXINT, + -1, + GTK_PARAM_READWRITE)); g_type_class_add_private (object_class, sizeof (GtkTreeMenuPrivate)); } @@ -416,8 +416,8 @@ _gtk_tree_menu_class_init (GtkTreeMenuClass *class) ****************************************************************/ static GObject * gtk_tree_menu_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) + guint n_construct_properties, + GObjectConstructParam *construct_properties) { GObject *object; GtkTreeMenu *menu; @@ -438,9 +438,9 @@ gtk_tree_menu_constructor (GType type, priv->context = gtk_cell_area_create_context (priv->area); - priv->size_changed_id = + priv->size_changed_id = g_signal_connect (priv->context, "notify", - G_CALLBACK (context_size_changed_cb), menu); + G_CALLBACK (context_size_changed_cb), menu); return object; } @@ -482,7 +482,7 @@ gtk_tree_menu_finalize (GObject *object) _gtk_tree_menu_set_row_separator_func (menu, NULL, NULL, NULL); _gtk_tree_menu_set_header_func (menu, NULL, NULL, NULL); - if (priv->root) + if (priv->root) gtk_tree_row_reference_free (priv->root); G_OBJECT_CLASS (_gtk_tree_menu_parent_class)->finalize (object); @@ -490,9 +490,9 @@ gtk_tree_menu_finalize (GObject *object) static void gtk_tree_menu_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GtkTreeMenu *menu = GTK_TREE_MENU (object); @@ -535,9 +535,9 @@ gtk_tree_menu_set_property (GObject *object, static void gtk_tree_menu_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) + guint prop_id, + GValue *value, + GParamSpec *pspec) { GtkTreeMenu *menu = GTK_TREE_MENU (object); GtkTreeMenuPrivate *priv = menu->priv; @@ -547,11 +547,11 @@ gtk_tree_menu_get_property (GObject *object, case PROP_MODEL: g_value_set_object (value, priv->model); break; - + case PROP_ROOT: g_value_set_boxed (value, priv->root); break; - + case PROP_CELL_AREA: g_value_set_object (value, priv->area); break; @@ -587,10 +587,10 @@ sync_reserve_submenu_size (GtkTreeMenu *menu) GtkMenuItem *item = l->data; if (gtk_menu_item_get_submenu (item) != NULL) - { - has_submenu = TRUE; - break; - } + { + has_submenu = TRUE; + break; + } } for (l = children; l; l = l->next) @@ -605,8 +605,8 @@ sync_reserve_submenu_size (GtkTreeMenu *menu) static void gtk_tree_menu_get_preferred_width (GtkWidget *widget, - gint *minimum_size, - gint *natural_size) + gint *minimum_size, + gint *natural_size) { GtkTreeMenu *menu = GTK_TREE_MENU (widget); GtkTreeMenuPrivate *priv = menu->priv; @@ -629,8 +629,8 @@ gtk_tree_menu_get_preferred_width (GtkWidget *widget, static void gtk_tree_menu_get_preferred_height (GtkWidget *widget, - gint *minimum_size, - gint *natural_size) + gint *minimum_size, + gint *natural_size) { GtkTreeMenu *menu = GTK_TREE_MENU (widget); GtkTreeMenuPrivate *priv = menu->priv; @@ -668,7 +668,7 @@ gtk_tree_menu_cell_layout_get_area (GtkCellLayout *layout) ****************************************************************/ static GtkWidget * gtk_tree_menu_get_path_item (GtkTreeMenu *menu, - GtkTreePath *search) + GtkTreePath *search) { GtkWidget *item = NULL; GList *children, *l; @@ -681,45 +681,45 @@ gtk_tree_menu_get_path_item (GtkTreeMenu *menu, GtkTreePath *path = NULL; if (GTK_IS_SEPARATOR_MENU_ITEM (child)) - { - GtkTreeRowReference *row = - g_object_get_qdata (G_OBJECT (child), tree_menu_path_quark); - - if (row) - { - path = gtk_tree_row_reference_get_path (row); - - if (!path) - /* Return any first child where it's row-reference became invalid, - * this is because row-references get null paths before we recieve - * the "row-deleted" signal. - */ - item = child; - } - } + { + GtkTreeRowReference *row = + g_object_get_qdata (G_OBJECT (child), tree_menu_path_quark); + + if (row) + { + path = gtk_tree_row_reference_get_path (row); + + if (!path) + /* Return any first child where it's row-reference became invalid, + * this is because row-references get null paths before we recieve + * the "row-deleted" signal. + */ + item = child; + } + } else if (!GTK_IS_TEAROFF_MENU_ITEM (child)) - { - GtkWidget *view = gtk_bin_get_child (GTK_BIN (child)); + { + GtkWidget *view = gtk_bin_get_child (GTK_BIN (child)); - /* It's always a cellview */ - if (GTK_IS_CELL_VIEW (view)) - path = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (view)); + /* It's always a cellview */ + if (GTK_IS_CELL_VIEW (view)) + path = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (view)); - if (!path) - /* Return any first child where it's row-reference became invalid, - * this is because row-references get null paths before we recieve - * the "row-deleted" signal. - */ - item = child; - } + if (!path) + /* Return any first child where it's row-reference became invalid, + * this is because row-references get null paths before we recieve + * the "row-deleted" signal. + */ + item = child; + } if (path) - { - if (gtk_tree_path_compare (search, path) == 0) - item = child; + { + if (gtk_tree_path_compare (search, path) == 0) + item = child; - gtk_tree_path_free (path); - } + gtk_tree_path_free (path); + } } g_list_free (children); @@ -729,8 +729,8 @@ gtk_tree_menu_get_path_item (GtkTreeMenu *menu, static gboolean gtk_tree_menu_path_in_menu (GtkTreeMenu *menu, - GtkTreePath *path, - gboolean *header_item) + GtkTreePath *path, + gboolean *header_item) { GtkTreeMenuPrivate *priv = menu->priv; gboolean in_menu = FALSE; @@ -746,21 +746,21 @@ gtk_tree_menu_path_in_menu (GtkTreeMenu *menu, GtkTreePath *search_path = gtk_tree_path_copy (path); if (root_path) - { - if (priv->menu_with_header && - gtk_tree_path_compare (root_path, search_path) == 0) - { - in_menu = TRUE; - is_header = TRUE; - } - else if (gtk_tree_path_get_depth (search_path) > 1) - { - gtk_tree_path_up (search_path); - - if (gtk_tree_path_compare (root_path, search_path) == 0) - in_menu = TRUE; - } - } + { + if (priv->menu_with_header && + gtk_tree_path_compare (root_path, search_path) == 0) + { + in_menu = TRUE; + is_header = TRUE; + } + else if (gtk_tree_path_get_depth (search_path) > 1) + { + gtk_tree_path_up (search_path); + + if (gtk_tree_path_compare (root_path, search_path) == 0) + in_menu = TRUE; + } + } gtk_tree_path_free (root_path); gtk_tree_path_free (search_path); } @@ -772,8 +772,8 @@ gtk_tree_menu_path_in_menu (GtkTreeMenu *menu, } static GtkWidget * -gtk_tree_menu_path_needs_submenu (GtkTreeMenu *menu, - GtkTreePath *search) +gtk_tree_menu_path_needs_submenu (GtkTreeMenu *menu, + GtkTreePath *search) { GtkWidget *item = NULL; GList *children, *l; @@ -794,23 +794,23 @@ gtk_tree_menu_path_needs_submenu (GtkTreeMenu *menu, /* Separators dont get submenus, if it already has a submenu then let * the submenu handle inserted rows */ - if (!GTK_IS_SEPARATOR_MENU_ITEM (child) && - !gtk_menu_item_get_submenu (GTK_MENU_ITEM (child))) - { - GtkWidget *view = gtk_bin_get_child (GTK_BIN (child)); + if (!GTK_IS_SEPARATOR_MENU_ITEM (child) && + !gtk_menu_item_get_submenu (GTK_MENU_ITEM (child))) + { + GtkWidget *view = gtk_bin_get_child (GTK_BIN (child)); - /* It's always a cellview */ - if (GTK_IS_CELL_VIEW (view)) - path = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (view)); - } + /* It's always a cellview */ + if (GTK_IS_CELL_VIEW (view)) + path = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (view)); + } if (path) - { - if (gtk_tree_path_compare (parent_path, path) == 0) - item = child; + { + if (gtk_tree_path_compare (parent_path, path) == 0) + item = child; - gtk_tree_path_free (path); - } + gtk_tree_path_free (path); + } } g_list_free (children); @@ -837,22 +837,22 @@ find_empty_submenu (GtkTreeMenu *menu) /* Separators dont get submenus, if it already has a submenu then let * the submenu handle inserted rows */ if (!GTK_IS_SEPARATOR_MENU_ITEM (child) && !GTK_IS_TEAROFF_MENU_ITEM (child)) - { - GtkWidget *view = gtk_bin_get_child (GTK_BIN (child)); + { + GtkWidget *view = gtk_bin_get_child (GTK_BIN (child)); - /* It's always a cellview */ - if (GTK_IS_CELL_VIEW (view)) - path = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (view)); - } + /* It's always a cellview */ + if (GTK_IS_CELL_VIEW (view)) + path = gtk_cell_view_get_displayed_row (GTK_CELL_VIEW (view)); + } if (path) - { - if (gtk_tree_model_get_iter (priv->model, &iter, path) && - !gtk_tree_model_iter_has_child (priv->model, &iter)) - submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (child)); + { + if (gtk_tree_model_get_iter (priv->model, &iter, path) && + !gtk_tree_model_iter_has_child (priv->model, &iter)) + submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (child)); - gtk_tree_path_free (path); - } + gtk_tree_path_free (path); + } } g_list_free (children); @@ -862,9 +862,9 @@ find_empty_submenu (GtkTreeMenu *menu) static void row_inserted_cb (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - GtkTreeMenu *menu) + GtkTreePath *path, + GtkTreeIter *iter, + GtkTreeMenu *menu) { GtkTreeMenuPrivate *priv = menu->priv; gint *indices, index, depth; @@ -874,56 +874,56 @@ row_inserted_cb (GtkTreeModel *model, if (gtk_tree_menu_path_in_menu (menu, path, NULL)) { if (priv->wrap_width > 0) - rebuild_menu (menu); + rebuild_menu (menu); else - { - /* Get the index of the path for this depth */ - indices = gtk_tree_path_get_indices (path); - depth = gtk_tree_path_get_depth (path); - index = indices[depth -1]; - - /* Menus with a header include a menuitem for it's root node - * and a separator menu item */ - if (priv->menu_with_header) - index += 2; - - /* Index after the tearoff item for the root menu if - * there is a tearoff item - */ - if (priv->root == NULL && priv->tearoff) - index += 1; - - item = gtk_tree_menu_create_item (menu, iter, FALSE); - gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item, index); - - /* Resize everything */ - gtk_cell_area_context_reset (menu->priv->context); - } + { + /* Get the index of the path for this depth */ + indices = gtk_tree_path_get_indices (path); + depth = gtk_tree_path_get_depth (path); + index = indices[depth -1]; + + /* Menus with a header include a menuitem for it's root node + * and a separator menu item */ + if (priv->menu_with_header) + index += 2; + + /* Index after the tearoff item for the root menu if + * there is a tearoff item + */ + if (priv->root == NULL && priv->tearoff) + index += 1; + + item = gtk_tree_menu_create_item (menu, iter, FALSE); + gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item, index); + + /* Resize everything */ + gtk_cell_area_context_reset (menu->priv->context); + } } else { /* Create submenus for iters if we need to */ item = gtk_tree_menu_path_needs_submenu (menu, path); if (item) - { - GtkTreePath *item_path = gtk_tree_path_copy (path); + { + GtkTreePath *item_path = gtk_tree_path_copy (path); - gtk_tree_path_up (item_path); - gtk_tree_menu_create_submenu (menu, item, item_path); - gtk_tree_path_free (item_path); - } + gtk_tree_path_up (item_path); + gtk_tree_menu_create_submenu (menu, item, item_path); + gtk_tree_path_free (item_path); + } } } static void row_deleted_cb (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeMenu *menu) + GtkTreePath *path, + GtkTreeMenu *menu) { GtkTreeMenuPrivate *priv = menu->priv; GtkWidget *item; - /* If it's the header item we leave it to the parent menu + /* If it's the header item we leave it to the parent menu * to remove us from its menu */ item = gtk_tree_menu_get_path_item (menu, path); @@ -931,32 +931,32 @@ row_deleted_cb (GtkTreeModel *model, if (item) { if (priv->wrap_width > 0) - rebuild_menu (menu); + rebuild_menu (menu); else - { - /* Get rid of the deleted item */ - gtk_widget_destroy (item); - - /* Resize everything */ - gtk_cell_area_context_reset (menu->priv->context); - } + { + /* Get rid of the deleted item */ + gtk_widget_destroy (item); + + /* Resize everything */ + gtk_cell_area_context_reset (menu->priv->context); + } } - else + else { /* It's up to the parent menu to destroy a child menu that becomes empty * since the topmost menu belongs to the user and is allowed to have no contents */ GtkWidget *submenu = find_empty_submenu (menu); if (submenu) - gtk_widget_destroy (submenu); + gtk_widget_destroy (submenu); } } static void row_reordered_cb (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - gint *new_order, - GtkTreeMenu *menu) + GtkTreePath *path, + GtkTreeIter *iter, + gint *new_order, + GtkTreeMenu *menu) { GtkTreeMenuPrivate *priv = menu->priv; gboolean this_menu = FALSE; @@ -966,10 +966,10 @@ row_reordered_cb (GtkTreeModel *model, else if (priv->root) { GtkTreePath *root_path = - gtk_tree_row_reference_get_path (priv->root); + gtk_tree_row_reference_get_path (priv->root); if (gtk_tree_path_compare (root_path, path) == 0) - this_menu = TRUE; + this_menu = TRUE; gtk_tree_path_free (root_path); } @@ -978,9 +978,9 @@ row_reordered_cb (GtkTreeModel *model, rebuild_menu (menu); } -static gint +static gint menu_item_position (GtkTreeMenu *menu, - GtkWidget *item) + GtkWidget *item) { GList *children, *l; gint position; @@ -991,7 +991,7 @@ menu_item_position (GtkTreeMenu *menu, GtkWidget *iitem = l->data; if (item == iitem) - break; + break; } g_list_free (children); @@ -1001,9 +1001,9 @@ menu_item_position (GtkTreeMenu *menu, static void row_changed_cb (GtkTreeModel *model, - GtkTreePath *path, - GtkTreeIter *iter, - GtkTreeMenu *menu) + GtkTreePath *path, + GtkTreeIter *iter, + GtkTreeMenu *menu) { GtkTreeMenuPrivate *priv = menu->priv; gboolean is_separator = FALSE; @@ -1015,69 +1015,69 @@ row_changed_cb (GtkTreeModel *model, if (priv->root) { GtkTreePath *root_path = - gtk_tree_row_reference_get_path (priv->root); - + gtk_tree_row_reference_get_path (priv->root); + if (root_path && gtk_tree_path_compare (root_path, path) == 0) - { - if (priv->header_func) - has_header = - priv->header_func (priv->model, iter, priv->header_data); - - if (has_header && !item) - { - item = gtk_separator_menu_item_new (); - gtk_widget_show (item); - gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item); - - item = gtk_tree_menu_create_item (menu, iter, TRUE); - gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item); - - priv->menu_with_header = TRUE; - } - else if (!has_header && item) - { - /* Destroy the header item and then the following separator */ - gtk_widget_destroy (item); - gtk_widget_destroy (GTK_MENU_SHELL (menu)->priv->children->data); - - priv->menu_with_header = FALSE; - } - - gtk_tree_path_free (root_path); - } + { + if (priv->header_func) + has_header = + priv->header_func (priv->model, iter, priv->header_data); + + if (has_header && !item) + { + item = gtk_separator_menu_item_new (); + gtk_widget_show (item); + gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item); + + item = gtk_tree_menu_create_item (menu, iter, TRUE); + gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item); + + priv->menu_with_header = TRUE; + } + else if (!has_header && item) + { + /* Destroy the header item and then the following separator */ + gtk_widget_destroy (item); + gtk_widget_destroy (GTK_MENU_SHELL (menu)->priv->children->data); + + priv->menu_with_header = FALSE; + } + + gtk_tree_path_free (root_path); + } } - + if (item) { if (priv->wrap_width > 0) - /* Ugly, we need to rebuild the menu here if - * the row-span/row-column values change - */ - rebuild_menu (menu); + /* Ugly, we need to rebuild the menu here if + * the row-span/row-column values change + */ + rebuild_menu (menu); else - { - if (priv->row_separator_func) - is_separator = - priv->row_separator_func (model, iter, - priv->row_separator_data); - - - if (is_separator != GTK_IS_SEPARATOR_MENU_ITEM (item)) - { - gint position = menu_item_position (menu, item); - - gtk_widget_destroy (item); - item = gtk_tree_menu_create_item (menu, iter, FALSE); - gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item, position); - } - } + { + if (priv->row_separator_func) + is_separator = + priv->row_separator_func (model, iter, + priv->row_separator_data); + + + if (is_separator != GTK_IS_SEPARATOR_MENU_ITEM (item)) + { + gint position = menu_item_position (menu, item); + + gtk_widget_destroy (item); + item = gtk_tree_menu_create_item (menu, iter, FALSE); + gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item, position); + } + } } } static void context_size_changed_cb (GtkCellAreaContext *context, - GParamSpec *pspec, - GtkWidget *menu) + GParamSpec *pspec, + GtkWidget *menu) { if (!strcmp (pspec->name, "minimum-width") || !strcmp (pspec->name, "natural-width") || @@ -1091,15 +1091,15 @@ area_is_sensitive (GtkCellArea *area) { GList *cells, *list; gboolean sensitive = FALSE; - + cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (area)); for (list = cells; list; list = list->next) { g_object_get (list->data, "sensitive", &sensitive, NULL); - + if (sensitive) - break; + break; } g_list_free (cells); @@ -1108,11 +1108,11 @@ area_is_sensitive (GtkCellArea *area) static void area_apply_attributes_cb (GtkCellArea *area, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gboolean is_expander, - gboolean is_expanded, - GtkTreeMenu *menu) + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gboolean is_expander, + gboolean is_expanded, + GtkTreeMenu *menu) { /* If the menu for this iter has a submenu */ GtkTreeMenuPrivate *priv = menu->priv; @@ -1130,26 +1130,26 @@ area_apply_attributes_cb (GtkCellArea *area, /* If there is no submenu, go ahead and update item sensitivity, * items with submenus are always sensitive */ if (item && !gtk_menu_item_get_submenu (GTK_MENU_ITEM (item))) - { - sensitive = area_is_sensitive (priv->area); - - gtk_widget_set_sensitive (item, sensitive); - - if (is_header) - { - /* For header items we need to set the sensitivity - * of the following separator item - */ - if (GTK_MENU_SHELL (menu)->priv->children && - GTK_MENU_SHELL (menu)->priv->children->next) - { - GtkWidget *separator = - GTK_MENU_SHELL (menu)->priv->children->next->data; - - gtk_widget_set_sensitive (separator, sensitive); - } - } - } + { + sensitive = area_is_sensitive (priv->area); + + gtk_widget_set_sensitive (item, sensitive); + + if (is_header) + { + /* For header items we need to set the sensitivity + * of the following separator item + */ + if (GTK_MENU_SHELL (menu)->priv->children && + GTK_MENU_SHELL (menu)->priv->children->next) + { + GtkWidget *separator = + GTK_MENU_SHELL (menu)->priv->children->next->data; + + gtk_widget_set_sensitive (separator, sensitive); + } + } + } } gtk_tree_path_free (path); @@ -1157,14 +1157,14 @@ area_apply_attributes_cb (GtkCellArea *area, static void gtk_tree_menu_set_area (GtkTreeMenu *menu, - GtkCellArea *area) + GtkCellArea *area) { GtkTreeMenuPrivate *priv = menu->priv; if (priv->area) { g_signal_handler_disconnect (priv->area, - priv->apply_attributes_id); + priv->apply_attributes_id); priv->apply_attributes_id = 0; g_object_unref (priv->area); @@ -1177,8 +1177,8 @@ gtk_tree_menu_set_area (GtkTreeMenu *menu, g_object_ref_sink (priv->area); priv->apply_attributes_id = - g_signal_connect (priv->area, "apply-attributes", - G_CALLBACK (area_apply_attributes_cb), menu); + g_signal_connect (priv->area, "apply-attributes", + G_CALLBACK (area_apply_attributes_cb), menu); } } @@ -1195,8 +1195,8 @@ menu_occupied (GtkTreeMenu *menu, { guint l, r, b, t; - gtk_container_child_get (GTK_CONTAINER (menu), - i->data, + gtk_container_child_get (GTK_CONTAINER (menu), + i->data, "left-attach", &l, "right-attach", &r, "bottom-attach", &b, @@ -1205,7 +1205,7 @@ menu_occupied (GtkTreeMenu *menu, /* look if this item intersects with the given coordinates */ if (right_attach > l && left_attach < r && bottom_attach > t && top_attach < b) - return TRUE; + return TRUE; } return FALSE; @@ -1213,54 +1213,54 @@ menu_occupied (GtkTreeMenu *menu, static void relayout_item (GtkTreeMenu *menu, - GtkWidget *item, - GtkTreeIter *iter, - GtkWidget *prev) + GtkWidget *item, + GtkTreeIter *iter, + GtkWidget *prev) { GtkTreeMenuPrivate *priv = menu->priv; gint current_col = 0, current_row = 0; gint rows = 1, cols = 1; - + if (priv->col_span_col == -1 && priv->row_span_col == -1 && prev) { gtk_container_child_get (GTK_CONTAINER (menu), prev, - "right-attach", ¤t_col, - "top-attach", ¤t_row, - NULL); + "right-attach", ¤t_col, + "top-attach", ¤t_row, + NULL); if (current_col + cols > priv->wrap_width) - { - current_col = 0; - current_row++; - } + { + current_col = 0; + current_row++; + } } else { if (priv->col_span_col != -1) - gtk_tree_model_get (priv->model, iter, - priv->col_span_col, &cols, - -1); + gtk_tree_model_get (priv->model, iter, + priv->col_span_col, &cols, + -1); if (priv->row_span_col != -1) - gtk_tree_model_get (priv->model, iter, - priv->row_span_col, &rows, - -1); + gtk_tree_model_get (priv->model, iter, + priv->row_span_col, &rows, + -1); while (1) - { - if (current_col + cols > priv->wrap_width) - { - current_col = 0; - current_row++; - } - - if (!menu_occupied (menu, - current_col, current_col + cols, - current_row, current_row + rows)) - break; - - current_col++; - } + { + if (current_col + cols > priv->wrap_width) + { + current_col = 0; + current_row++; + } + + if (!menu_occupied (menu, + current_col, current_col + cols, + current_row, current_row + rows)) + break; + + current_col++; + } } /* set attach props */ @@ -1271,8 +1271,8 @@ relayout_item (GtkTreeMenu *menu, static void gtk_tree_menu_create_submenu (GtkTreeMenu *menu, - GtkWidget *item, - GtkTreePath *path) + GtkWidget *item, + GtkTreePath *path) { GtkTreeMenuPrivate *priv = menu->priv; GtkWidget *view; @@ -1283,31 +1283,31 @@ gtk_tree_menu_create_submenu (GtkTreeMenu *menu, submenu = _gtk_tree_menu_new_with_area (priv->area); - _gtk_tree_menu_set_row_separator_func (GTK_TREE_MENU (submenu), - priv->row_separator_func, - priv->row_separator_data, - priv->row_separator_destroy); - _gtk_tree_menu_set_header_func (GTK_TREE_MENU (submenu), - priv->header_func, - priv->header_data, - priv->header_destroy); + _gtk_tree_menu_set_row_separator_func (GTK_TREE_MENU (submenu), + priv->row_separator_func, + priv->row_separator_data, + priv->row_separator_destroy); + _gtk_tree_menu_set_header_func (GTK_TREE_MENU (submenu), + priv->header_func, + priv->header_data, + priv->header_destroy); _gtk_tree_menu_set_wrap_width (GTK_TREE_MENU (submenu), priv->wrap_width); _gtk_tree_menu_set_row_span_column (GTK_TREE_MENU (submenu), priv->row_span_col); _gtk_tree_menu_set_column_span_column (GTK_TREE_MENU (submenu), priv->col_span_col); - + gtk_tree_menu_set_model_internal (GTK_TREE_MENU (submenu), priv->model); _gtk_tree_menu_set_root (GTK_TREE_MENU (submenu), path); gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu); - - g_signal_connect (submenu, "menu-activate", - G_CALLBACK (submenu_activated_cb), menu); + + g_signal_connect (submenu, "menu-activate", + G_CALLBACK (submenu_activated_cb), menu); } static GtkWidget * gtk_tree_menu_create_item (GtkTreeMenu *menu, - GtkTreeIter *iter, - gboolean header_item) + GtkTreeIter *iter, + gboolean header_item) { GtkTreeMenuPrivate *priv = menu->priv; GtkWidget *item, *view; @@ -1317,9 +1317,9 @@ gtk_tree_menu_create_item (GtkTreeMenu *menu, path = gtk_tree_model_get_path (priv->model, iter); if (priv->row_separator_func) - is_separator = + is_separator = priv->row_separator_func (priv->model, iter, - priv->row_separator_data); + priv->row_separator_data); if (is_separator) { @@ -1327,9 +1327,9 @@ gtk_tree_menu_create_item (GtkTreeMenu *menu, gtk_widget_show (item); g_object_set_qdata_full (G_OBJECT (item), - tree_menu_path_quark, - gtk_tree_row_reference_new (priv->model, path), - (GDestroyNotify)gtk_tree_row_reference_free); + tree_menu_path_quark, + gtk_tree_row_reference_new (priv->model, path), + (GDestroyNotify)gtk_tree_row_reference_free); } else { @@ -1337,19 +1337,19 @@ gtk_tree_menu_create_item (GtkTreeMenu *menu, item = gtk_menu_item_new (); gtk_widget_show (view); gtk_widget_show (item); - + gtk_cell_view_set_model (GTK_CELL_VIEW (view), priv->model); gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (view), path); - + gtk_widget_show (view); gtk_container_add (GTK_CONTAINER (item), view); - + g_signal_connect (item, "activate", G_CALLBACK (item_activated_cb), menu); /* Add a GtkTreeMenu submenu to render the children of this row */ if (header_item == FALSE && - gtk_tree_model_iter_has_child (priv->model, iter)) - gtk_tree_menu_create_submenu (menu, item, path); + gtk_tree_model_iter_has_child (priv->model, iter)) + gtk_tree_menu_create_submenu (menu, item, path); } gtk_tree_path_free (path); @@ -1357,15 +1357,15 @@ gtk_tree_menu_create_item (GtkTreeMenu *menu, return item; } -static inline void +static inline void rebuild_menu (GtkTreeMenu *menu) { GtkTreeMenuPrivate *priv = menu->priv; /* Destroy all the menu items */ - gtk_container_foreach (GTK_CONTAINER (menu), - (GtkCallback) gtk_widget_destroy, NULL); - + gtk_container_foreach (GTK_CONTAINER (menu), + (GtkCallback) gtk_widget_destroy, NULL); + /* Populate */ if (priv->model) gtk_tree_menu_populate (menu); @@ -1391,43 +1391,43 @@ gtk_tree_menu_populate (GtkTreeMenu *menu) if (path) { if (gtk_tree_model_get_iter (priv->model, &parent, path)) - { - valid = gtk_tree_model_iter_children (priv->model, &iter, &parent); - - if (priv->header_func && - priv->header_func (priv->model, &parent, priv->header_data)) - { - /* Add a submenu header for rows which desire one, used for - * combo boxes to allow all rows to be activatable/selectable - */ - menu_item = gtk_tree_menu_create_item (menu, &parent, TRUE); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); - - menu_item = gtk_separator_menu_item_new (); - gtk_widget_show (menu_item); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); - - prev = menu_item; - priv->menu_with_header = TRUE; - } - } + { + valid = gtk_tree_model_iter_children (priv->model, &iter, &parent); + + if (priv->header_func && + priv->header_func (priv->model, &parent, priv->header_data)) + { + /* Add a submenu header for rows which desire one, used for + * combo boxes to allow all rows to be activatable/selectable + */ + menu_item = gtk_tree_menu_create_item (menu, &parent, TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + + menu_item = gtk_separator_menu_item_new (); + gtk_widget_show (menu_item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + + prev = menu_item; + priv->menu_with_header = TRUE; + } + } gtk_tree_path_free (path); } else { /* Tearoff menu items only go in the root menu */ if (priv->tearoff) - { - menu_item = gtk_tearoff_menu_item_new (); - gtk_widget_show (menu_item); + { + menu_item = gtk_tearoff_menu_item_new (); + gtk_widget_show (menu_item); - if (priv->wrap_width > 0) - gtk_menu_attach (GTK_MENU (menu), menu_item, 0, priv->wrap_width, 0, 1); - else - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + if (priv->wrap_width > 0) + gtk_menu_attach (GTK_MENU (menu), menu_item, 0, priv->wrap_width, 0, 1); + else + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); - prev = menu_item; - } + prev = menu_item; + } valid = gtk_tree_model_iter_children (priv->model, &iter, NULL); } @@ -1441,7 +1441,7 @@ gtk_tree_menu_populate (GtkTreeMenu *menu) gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); if (priv->wrap_width > 0) - relayout_item (menu, menu_item, &iter, prev); + relayout_item (menu, menu_item, &iter, prev); prev = menu_item; valid = gtk_tree_model_iter_next (priv->model, &iter); @@ -1450,7 +1450,7 @@ gtk_tree_menu_populate (GtkTreeMenu *menu) static void item_activated_cb (GtkMenuItem *item, - GtkTreeMenu *menu) + GtkTreeMenu *menu) { GtkCellView *view; GtkTreePath *path; @@ -1462,9 +1462,9 @@ item_activated_cb (GtkMenuItem *item, view = GTK_CELL_VIEW (gtk_bin_get_child (GTK_BIN (item))); path = gtk_cell_view_get_displayed_row (view); path_str = gtk_tree_path_to_string (path); - + g_signal_emit (menu, tree_menu_signals[SIGNAL_MENU_ACTIVATE], 0, path_str); - + g_free (path_str); gtk_tree_path_free (path); } @@ -1472,8 +1472,8 @@ item_activated_cb (GtkMenuItem *item, static void submenu_activated_cb (GtkTreeMenu *submenu, - const gchar *path, - GtkTreeMenu *menu) + const gchar *path, + GtkTreeMenu *menu) { g_signal_emit (menu, tree_menu_signals[SIGNAL_MENU_ACTIVATE], 0, path); } @@ -1483,7 +1483,7 @@ submenu_activated_cb (GtkTreeMenu *submenu, * until the root is set and then build the menu) */ static void gtk_tree_menu_set_model_internal (GtkTreeMenu *menu, - GtkTreeModel *model) + GtkTreeModel *model) { GtkTreeMenuPrivate *priv; @@ -1492,40 +1492,40 @@ gtk_tree_menu_set_model_internal (GtkTreeMenu *menu, if (priv->model != model) { if (priv->model) - { - /* Disconnect signals */ - g_signal_handler_disconnect (priv->model, - priv->row_inserted_id); - g_signal_handler_disconnect (priv->model, - priv->row_deleted_id); - g_signal_handler_disconnect (priv->model, - priv->row_reordered_id); - g_signal_handler_disconnect (priv->model, - priv->row_changed_id); - priv->row_inserted_id = 0; - priv->row_deleted_id = 0; - priv->row_reordered_id = 0; - priv->row_changed_id = 0; - - g_object_unref (priv->model); - } + { + /* Disconnect signals */ + g_signal_handler_disconnect (priv->model, + priv->row_inserted_id); + g_signal_handler_disconnect (priv->model, + priv->row_deleted_id); + g_signal_handler_disconnect (priv->model, + priv->row_reordered_id); + g_signal_handler_disconnect (priv->model, + priv->row_changed_id); + priv->row_inserted_id = 0; + priv->row_deleted_id = 0; + priv->row_reordered_id = 0; + priv->row_changed_id = 0; + + g_object_unref (priv->model); + } priv->model = model; if (priv->model) - { - g_object_ref (priv->model); - - /* Connect signals */ - priv->row_inserted_id = g_signal_connect (priv->model, "row-inserted", - G_CALLBACK (row_inserted_cb), menu); - priv->row_deleted_id = g_signal_connect (priv->model, "row-deleted", - G_CALLBACK (row_deleted_cb), menu); - priv->row_reordered_id = g_signal_connect (priv->model, "rows-reordered", - G_CALLBACK (row_reordered_cb), menu); - priv->row_changed_id = g_signal_connect (priv->model, "row-changed", - G_CALLBACK (row_changed_cb), menu); - } + { + g_object_ref (priv->model); + + /* Connect signals */ + priv->row_inserted_id = g_signal_connect (priv->model, "row-inserted", + G_CALLBACK (row_inserted_cb), menu); + priv->row_deleted_id = g_signal_connect (priv->model, "row-deleted", + G_CALLBACK (row_deleted_cb), menu); + priv->row_reordered_id = g_signal_connect (priv->model, "rows-reordered", + G_CALLBACK (row_reordered_cb), menu); + priv->row_changed_id = g_signal_connect (priv->model, "row-changed", + G_CALLBACK (row_changed_cb), menu); + } } } @@ -1561,9 +1561,9 @@ _gtk_tree_menu_new (void) GtkWidget * _gtk_tree_menu_new_with_area (GtkCellArea *area) { - return (GtkWidget *)g_object_new (GTK_TYPE_TREE_MENU, - "cell-area", area, - NULL); + return (GtkWidget *)g_object_new (GTK_TYPE_TREE_MENU, + "cell-area", area, + NULL); } /** @@ -1580,14 +1580,14 @@ _gtk_tree_menu_new_with_area (GtkCellArea *area) */ GtkWidget * _gtk_tree_menu_new_full (GtkCellArea *area, - GtkTreeModel *model, - GtkTreePath *root) + GtkTreeModel *model, + GtkTreePath *root) { - return (GtkWidget *)g_object_new (GTK_TYPE_TREE_MENU, - "cell-area", area, - "model", model, - "root", root, - NULL); + return (GtkWidget *)g_object_new (GTK_TYPE_TREE_MENU, + "cell-area", area, + "model", model, + "root", root, + NULL); } /** @@ -1601,7 +1601,7 @@ _gtk_tree_menu_new_full (GtkCellArea *area, */ void _gtk_tree_menu_set_model (GtkTreeMenu *menu, - GtkTreeModel *model) + GtkTreeModel *model) { g_return_if_fail (GTK_IS_TREE_MENU (menu)); g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model)); @@ -1646,7 +1646,7 @@ _gtk_tree_menu_get_model (GtkTreeMenu *menu) */ void _gtk_tree_menu_set_root (GtkTreeMenu *menu, - GtkTreePath *path) + GtkTreePath *path) { GtkTreeMenuPrivate *priv; @@ -1655,7 +1655,7 @@ _gtk_tree_menu_set_root (GtkTreeMenu *menu, priv = menu->priv; - if (priv->root) + if (priv->root) gtk_tree_row_reference_free (priv->root); if (path) @@ -1726,7 +1726,7 @@ _gtk_tree_menu_get_tearoff (GtkTreeMenu *menu) */ void _gtk_tree_menu_set_tearoff (GtkTreeMenu *menu, - gboolean tearoff) + gboolean tearoff) { GtkTreeMenuPrivate *priv; @@ -1748,7 +1748,7 @@ _gtk_tree_menu_set_tearoff (GtkTreeMenu *menu, * _gtk_tree_menu_get_wrap_width: * @menu: a #GtkTreeMenu * - * Gets the wrap width which is used to determine the number of columns + * Gets the wrap width which is used to determine the number of columns * for @menu. If the wrap width is larger than 1, @menu is in table mode. * * Return value: the wrap width. @@ -1772,14 +1772,14 @@ _gtk_tree_menu_get_wrap_width (GtkTreeMenu *menu) * @menu: a #GtkTreeMenu * @width: the wrap width * - * Sets the wrap width which is used to determine the number of columns + * Sets the wrap width which is used to determine the number of columns * for @menu. If the wrap width is larger than 1, @menu is in table mode. * * Since: 3.0 */ void _gtk_tree_menu_set_wrap_width (GtkTreeMenu *menu, - gint width) + gint width) { GtkTreeMenuPrivate *priv; @@ -1835,7 +1835,7 @@ _gtk_tree_menu_get_row_span_column (GtkTreeMenu *menu) */ void _gtk_tree_menu_set_row_span_column (GtkTreeMenu *menu, - gint row_span) + gint row_span) { GtkTreeMenuPrivate *priv; @@ -1848,7 +1848,7 @@ _gtk_tree_menu_set_row_span_column (GtkTreeMenu *menu, priv->row_span_col = row_span; if (priv->wrap_width > 0) - rebuild_menu (menu); + rebuild_menu (menu); g_object_notify (G_OBJECT (menu), "row-span-column"); } @@ -1891,7 +1891,7 @@ _gtk_tree_menu_get_column_span_column (GtkTreeMenu *menu) */ void _gtk_tree_menu_set_column_span_column (GtkTreeMenu *menu, - gint column_span) + gint column_span) { GtkTreeMenuPrivate *priv; @@ -1904,7 +1904,7 @@ _gtk_tree_menu_set_column_span_column (GtkTreeMenu *menu, priv->col_span_col = column_span; if (priv->wrap_width > 0) - rebuild_menu (menu); + rebuild_menu (menu); g_object_notify (G_OBJECT (menu), "column-span-column"); } @@ -1947,9 +1947,9 @@ _gtk_tree_menu_get_row_separator_func (GtkTreeMenu *menu) */ void _gtk_tree_menu_set_row_separator_func (GtkTreeMenu *menu, - GtkTreeViewRowSeparatorFunc func, - gpointer data, - GDestroyNotify destroy) + GtkTreeViewRowSeparatorFunc func, + gpointer data, + GDestroyNotify destroy) { GtkTreeMenuPrivate *priv; @@ -1970,9 +1970,9 @@ _gtk_tree_menu_set_row_separator_func (GtkTreeMenu *menu, /** * _gtk_tree_menu_get_header_func: * @menu: a #GtkTreeMenu - * + * * Gets the current #GtkTreeMenuHeaderFunc header function. - * + * * Return value: the current header function. * * Since: 3.0 @@ -1995,21 +1995,21 @@ _gtk_tree_menu_get_header_func (GtkTreeMenu *menu) * @func: (allow-none): a #GtkTreeMenuHeaderFunc, or %NULL to unset the header function. * @data: (allow-none): user data to pass to @func, or %NULL * @destroy: (allow-none): destroy notifier for @data, or %NULL - * + * * Sets the header function, which is used to determine * whether a row width children should contain a leading header * menu item to allow that row to be selectable as an independant * menu item. If the header function is %NULL, no rows with children - * have menu items which can be activated as leafs. + * have menu items which can be activated as leafs. * This is the default value. * * Since: 3.0 */ void _gtk_tree_menu_set_header_func (GtkTreeMenu *menu, - GtkTreeMenuHeaderFunc func, - gpointer data, - GDestroyNotify destroy) + GtkTreeMenuHeaderFunc func, + gpointer data, + GDestroyNotify destroy) { GtkTreeMenuPrivate *priv; diff --git a/gtk/gtktreemenu.h b/gtk/gtktreemenu.h index 6292466619..bb6d6b786a 100644 --- a/gtk/gtktreemenu.h +++ b/gtk/gtktreemenu.h @@ -52,16 +52,16 @@ typedef struct _GtkTreeMenuPrivate GtkTreeMenuPrivate; * @iter: the #GtkTreeIter pointing at a row in @model * @data: user data * - * Function type for determining whether the row pointed to by @iter + * Function type for determining whether the row pointed to by @iter * which has children should be replicated as a header item in the * child menu. - * - * Return value: %TRUE if @iter should have an activatable header menu + * + * Return value: %TRUE if @iter should have an activatable header menu * item created for it in a submenu. */ typedef gboolean (*GtkTreeMenuHeaderFunc) (GtkTreeModel *model, - GtkTreeIter *iter, - gpointer data); + GtkTreeIter *iter, + gpointer data); struct _GtkTreeMenu { @@ -90,38 +90,38 @@ GType _gtk_tree_menu_get_type (void) G_GNU GtkWidget *_gtk_tree_menu_new (void); GtkWidget *_gtk_tree_menu_new_with_area (GtkCellArea *area); GtkWidget *_gtk_tree_menu_new_full (GtkCellArea *area, - GtkTreeModel *model, - GtkTreePath *root); + GtkTreeModel *model, + GtkTreePath *root); void _gtk_tree_menu_set_model (GtkTreeMenu *menu, - GtkTreeModel *model); + GtkTreeModel *model); GtkTreeModel *_gtk_tree_menu_get_model (GtkTreeMenu *menu); void _gtk_tree_menu_set_root (GtkTreeMenu *menu, - GtkTreePath *path); + GtkTreePath *path); GtkTreePath *_gtk_tree_menu_get_root (GtkTreeMenu *menu); gboolean _gtk_tree_menu_get_tearoff (GtkTreeMenu *menu); void _gtk_tree_menu_set_tearoff (GtkTreeMenu *menu, - gboolean tearoff); + gboolean tearoff); gint _gtk_tree_menu_get_wrap_width (GtkTreeMenu *menu); void _gtk_tree_menu_set_wrap_width (GtkTreeMenu *menu, - gint width); + gint width); gint _gtk_tree_menu_get_row_span_column (GtkTreeMenu *menu); void _gtk_tree_menu_set_row_span_column (GtkTreeMenu *menu, - gint row_span); + gint row_span); gint _gtk_tree_menu_get_column_span_column (GtkTreeMenu *menu); void _gtk_tree_menu_set_column_span_column (GtkTreeMenu *menu, - gint column_span); + gint column_span); GtkTreeViewRowSeparatorFunc _gtk_tree_menu_get_row_separator_func (GtkTreeMenu *menu); void _gtk_tree_menu_set_row_separator_func (GtkTreeMenu *menu, - GtkTreeViewRowSeparatorFunc func, - gpointer data, - GDestroyNotify destroy); + GtkTreeViewRowSeparatorFunc func, + gpointer data, + GDestroyNotify destroy); GtkTreeMenuHeaderFunc _gtk_tree_menu_get_header_func (GtkTreeMenu *menu); void _gtk_tree_menu_set_header_func (GtkTreeMenu *menu, - GtkTreeMenuHeaderFunc func, - gpointer data, - GDestroyNotify destroy); + GtkTreeMenuHeaderFunc func, + gpointer data, + GDestroyNotify destroy); G_END_DECLS -- 2.30.2